Skip to content
Browse files

Custom snippets for Ruby and Rspec

  • Loading branch information...
1 parent 4c84b38 commit 8af665a97b9d98361b58aec20ba67723729d2f1a Jamal El Milahi committed Mar 8, 2012
Showing with 39 additions and 0 deletions.
  1. +39 −0 .janus/snipmate-snippets/snippets/ruby.snippets
View
39 .janus/snipmate-snippets/snippets/ruby.snippets
@@ -0,0 +1,39 @@
+#------------------------------------------------------
+# Extra Ruby snippets
+#------------------------------------------------------
+
+# rspec
+snippet let
+ let(:${1}) { ${2:Factory} :${3:class_name} }
+snippet desit
+ describe '${1}' do
+ it '${2:should} ${3}' do
+ ${0}
+ end
+ end
+snippet des
+ describe '${1}' do
+ ${0}
+ end
+snippet con
+ context '${1}' do
+ ${0}
+ end
+snippet vp
+ validates :${1:attribute}, presence: true
+ ${0}
+snippet ithc
+ it { should have_db_column(:${1:column_name}).of_type(:${2:type}) }
+snippet ithi
+ it { should have_db_index(:${1:column_name})
+snippet itbt
+ it { should belong_to :${1:class} }
+snippet ithm
+ it { should have_many :${1:collection} }
+snippet itvp
+ it { should validate_presence_of :${1:attribute} }
+snippet itr
+ it { should route(:${1:method}, '${2:route}').to(${3:controller:} :${4:controller_name}, action: :${5:action_name}${0}) }
+
+
+

0 comments on commit 8af665a

Please sign in to comment.
Something went wrong with that request. Please try again.