forked from kaichen/vim-snipmate-ruby-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruby-rspec_shoulda_controller.snippets
48 lines (40 loc) · 1.13 KB
/
ruby-rspec_shoulda_controller.snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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 itshrespw
it { should respond_with(:${1:success|redirect|missing|error}) }
snippet itshrespwc
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 }