From 673415f2d0670b62597d9e00ade3ad8b06d9e437 Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Sun, 23 Jun 2013 14:15:22 +0400 Subject: [PATCH 1/3] move accepts_nested_attributes_for to attributes section --- snippets/ruby.snippets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index b9fbf21..c7cad04 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -164,6 +164,8 @@ snippet atp attr_protected :${1:attr_names} snippet ata attr_accessible :${1:attr_names} +snippet ana + accepts_nested_attributes_for :${1:association} snippet ivc @${1:variable_name} ||= ${2:chached_value} # include Enumerable @@ -1001,5 +1003,3 @@ snippet shared shared_examples "${1:shared examples name}" ${2} snippet itb it_behaves_like "${1:shared examples name}"${2} -snippet ana - accepts_nested_attributes_for :${1:association} From c3403b2daa639370c24841ec62a6b75ead03badc Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Sun, 23 Jun 2013 14:18:05 +0400 Subject: [PATCH 2/3] make rspec section definiton comment more readable --- snippets/ruby.snippets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index c7cad04..0b5d49c 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -947,7 +947,9 @@ snippet tre ${3} snippet tref t.references :${1:model} -#rspec +######################################## +# Rspec snippets - see below # +######################################## snippet it it "${1:spec_name}" do ${2} From e3e7ab1b45dc264c7aa5348a677371f3d83e80ab Mon Sep 17 00:00:00 2001 From: babybeasimple Date: Sun, 23 Jun 2013 14:45:32 +0400 Subject: [PATCH 3/3] add rspec shoulda matchers snippets --- snippets/ruby.snippets | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/snippets/ruby.snippets b/snippets/ruby.snippets index 0b5d49c..66c5d1a 100644 --- a/snippets/ruby.snippets +++ b/snippets/ruby.snippets @@ -1005,3 +1005,62 @@ snippet shared shared_examples "${1:shared examples name}" ${2} snippet itb it_behaves_like "${1:shared examples name}"${2} +#ShouldaMatchers#ActionController +snippet sfp + it { should filter_param :${1:key} } +snippet srt + it { should redirect_to ${1:url} } +snippet srtp + it { should render_template ${1} } +snippet srwl + it { should render_with_layout ${1} } +snippet srf + it { should rescue_from ${1:exception} } +snippet srw + it { should respond_with ${1:status} } +snippet sr + it { should route(:${1:method}, '${2:path}') } +snippet sss + it { should set_session :${1:key} } +snippet ssf + it { should set_the_flash('${1}') } +#ShouldaMatchers#ActiveModel +snippet sama + it { should allow_mass_assignment_of :${1} } +snippet sav + it { should allow_value(${1}) } +snippet see + it { should ensure_exclusion_of :${1} } +snippet sei + it { should ensure_inclusion_of :${1} } +snippet sel + it { should ensure_length_of :${1} } +snippet sva + it { should validate_acceptance_of :${1} } +snippet svc + it { should validate_confirmation_of :${1} } +snippet svn + it { should validate_numericality_of :${1} } +snippet svp + it { should validate_presence_of :${1} } +snippet svu + it { should validate_uniqueness_of :${1} } +#ShouldaMatchers#ActiveRecord +snippet sana + it { should accept_nested_attributes_for :${1} } +snippet sb + it { should belong_to :${1} } +snippet shbtm + it { should have_and_belong_to_many :${1} } +snippet shc + it { should have_db_column :${1} } +snippet shi + it { should have_db_index :${1} } +snippet shm + it { should have_many :${1} } +snippet sho + it { should have_one :${1} } +snippet shroa + it { should have_readonly_attribute :${1} } +snippet ss + it { should serialize :${1} }