forked from kaichen/vim-snipmate-ruby-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more snippets and split testunit from ruby.snippets
- Loading branch information
Showing
13 changed files
with
565 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ snippet Fw | |
Factory(:${1:factory}, :${2}) | ||
snippet Fbw | ||
Factory.build(:${1:factory}, :${2}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ snippet wants | |
wants.${1:js|json|xml|html}${2} | ||
snippet flash | ||
flash[:${1:notice}] = "${2}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Rspec Rails | ||
|
||
snippet itres | ||
it { response.should be_${1} } | ||
snippet itrend | ||
it { response.should render_template(:${1}) } | ||
snippet itred | ||
it { response.should redirect_to(${1}) } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Shoulda macros for Rspec | ||
|
||
# association | ||
snippet itshbt shoulda macros for rspec: should_belong_to | ||
it { should_belong_to :${1:association} } | ||
snippet itshhabtm shoulda macros for rspec: should_have_and_belong_to_many | ||
it { should_have_and_belong_to_many :${1:association} } | ||
snippet itshhm shoulda macros for rspec: should_have_many | ||
it { should_have_many :${1:association} } | ||
snippet itshho shoulda macros for rspec: should_have_one | ||
it { should_have_one :${1:association} } | ||
|
||
# assign_to | ||
snippet itshat | ||
it { should assign_to(:${1:model}) } | ||
snippet itshnat | ||
it { should_not assign_to(:${1:model}) } | ||
snippet itshatwk | ||
it { should assign_to(:${1:model}).with_kind_of(${2:klass}) } | ||
snippet itshatw | ||
it { should assign_to(:${1:model}).with(@${2}) } | ||
|
||
# filter_param | ||
snippet itshfp | ||
it { should filter_param(:${1:field}) } | ||
|
||
# layout | ||
snippet itshrwl | ||
it { should render_with_layout } | ||
snippet itshnrwl | ||
it { should_not render_with_layout } | ||
|
||
# respond | ||
snippet itshrepw | ||
it { should respond_with(:${1:success|redirect|missing|error}) } | ||
snippet itshrepwc | ||
it { should respond_with_content_type(:${1:xml|csv|atom|yaml|text}) } | ||
|
||
# route | ||
snippet itshroute | ||
it { should route(:${1:method}, "/${2:path}").to(:action => :${3:action}) } | ||
|
||
# session | ||
snippet itshsets | ||
it { should set_session(:${1:message}) } | ||
snippet itshsetst | ||
it { should set_session(:${1:key}).to(${2:value}) } | ||
snippet itshnsets | ||
it { should_not set_session(:${1:key}) } | ||
|
||
# flash | ||
snippet itshsetfl | ||
it { should set_the_flash } | ||
snippet itshsetflt | ||
it { should set_the_flash.to(/${1:message}/i) } | ||
snippet itshnsetfl | ||
it { should_not set_the_flash } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Shoulda macros for Rspec | ||
|
||
# assign_to | ||
snippet itshat | ||
it { should assign_to(:${1:model}) } | ||
snippet itshnat | ||
it { should_not assign_to(:${1:model}) } | ||
snippet itshatwk | ||
it { should assign_to(:${1:model}).with_kind_of(${2:klass}) } | ||
snippet itshatw | ||
it { should assign_to(:${1:model}).with(@${2}) } | ||
|
||
# filter_param | ||
snippet itshfp | ||
it { should filter_param(:${1:field}) } | ||
|
||
# layout | ||
snippet itshrwl | ||
it { should render_with_layout } | ||
snippet itshnrwl | ||
it { should_not render_with_layout } | ||
|
||
# respond | ||
snippet itshrepw | ||
it { should respond_with(:${1:success|redirect|missing|error}) } | ||
snippet itshrepwc | ||
it { should respond_with_content_type(:${1:xml|csv|atom|yaml|text}) } | ||
|
||
# route | ||
snippet itshroute | ||
it { should route(:${1:method}, "/${2:path}").to(:action => :${3:action}) } | ||
|
||
# session | ||
snippet itshsets | ||
it { should set_session(:${1:message}) } | ||
snippet itshsetst | ||
it { should set_session(:${1:key}).to(${2:value}) } | ||
snippet itshnsets | ||
it { should_not set_session(:${1:key}) } | ||
|
||
# flash | ||
snippet itshsetfl | ||
it { should set_the_flash } | ||
snippet itshsetflt | ||
it { should set_the_flash.to(/${1:message}/i) } | ||
snippet itshnsetfl | ||
it { should_not set_the_flash } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Shoulda macros for Rspec | ||
|
||
# association | ||
snippet itshbt shoulda macros for rspec: should_belong_to | ||
it { should_belong_to :${1:association} } | ||
snippet itshhabtm shoulda macros for rspec: should_have_and_belong_to_many | ||
it { should_have_and_belong_to_many :${1:association} } | ||
snippet itshhm shoulda macros for rspec: should_have_many | ||
it { should_have_many :${1:association} } | ||
snippet itshho shoulda macros for rspec: should_have_one | ||
it { should_have_one :${1:association} } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# TestUnit | ||
|
||
snippet tc | ||
require \"test/unit\" | ||
|
||
require \"${1:library_file_name}\" | ||
|
||
class Test${2:$1} < Test::Unit::TestCase | ||
def test_${3:case_name} | ||
${4} | ||
end | ||
end | ||
snippet ts | ||
require \"test/unit\" | ||
|
||
require \"tc_${1:test_case_file}\" | ||
require \"tc_${2:test_case_file}\"${3} | ||
snippet as | ||
assert(${1:test}, \"${2:Failure message.}\")${3} | ||
snippet ase | ||
assert_equal(${1:expected}, ${2:actual})${3} | ||
snippet asne | ||
assert_not_equal(${1:unexpected}, ${2:actual})${3} | ||
snippet asid | ||
assert_in_delta(${1:expected_float}, ${2:actual_float}, ${3:2 ** -20})${4} | ||
snippet asio | ||
assert_instance_of(${1:ExpectedClass}, ${2:actual_instance})${3} | ||
snippet asko | ||
assert_kind_of(${1:ExpectedKind}, ${2:actual_instance})${3} | ||
snippet asn | ||
assert_nil(${1:instance})${2} | ||
snippet asnn | ||
assert_not_nil(${1:instance})${2} | ||
snippet asm | ||
assert_match(/${1:expected_pattern}/, ${2:actual_string})${3} | ||
snippet asnm | ||
assert_no_match(/${1:unexpected_pattern}/, ${2:actual_string})${3} | ||
snippet aso | ||
assert_operator(${1:left}, :${2:operator}, ${3:right})${4} | ||
snippet asr | ||
assert_raise(${1:Exception}) { ${2} } | ||
snippet asnr | ||
assert_nothing_raised(${1:Exception}) { ${2} } | ||
snippet asrt | ||
assert_respond_to(${1:object}, :${2:method})${3} | ||
snippet ass assert_same(..) | ||
assert_same(${1:expected}, ${2:actual})${3} | ||
snippet ass assert_send(..) | ||
assert_send([${1:object}, :${2:message}, ${3:args}])${4} | ||
snippet asns | ||
assert_not_same(${1:unexpected}, ${2:actual})${3} | ||
snippet ast | ||
assert_throws(:${1:expected}) { ${2} } | ||
snippet asnt | ||
assert_nothing_thrown { ${1} } | ||
|
Oops, something went wrong.