remarkable_rails 3.1.8 → 3.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +91 -88
- data/LICENSE +20 -20
- data/README +80 -80
- data/lib/remarkable_rails/action_controller/base.rb +29 -29
- data/lib/remarkable_rails/action_controller/macro_stubs.rb +459 -457
- data/lib/remarkable_rails/action_controller/matchers/assign_to_matcher.rb +92 -92
- data/lib/remarkable_rails/action_controller/matchers/filter_params_matcher.rb +41 -41
- data/lib/remarkable_rails/action_controller/matchers/redirect_to_matcher.rb +119 -119
- data/lib/remarkable_rails/action_controller/matchers/render_template_matcher.rb +146 -146
- data/lib/remarkable_rails/action_controller/matchers/respond_with_matcher.rb +126 -126
- data/lib/remarkable_rails/action_controller/matchers/route_matcher.rb +135 -109
- data/lib/remarkable_rails/action_controller/matchers/set_cookies_matcher.rb +49 -49
- data/lib/remarkable_rails/action_controller/matchers/set_session_matcher.rb +106 -106
- data/lib/remarkable_rails/action_controller/matchers/set_the_flash_matcher.rb +54 -54
- data/lib/remarkable_rails/action_controller.rb +22 -22
- data/lib/remarkable_rails/action_view/base.rb +7 -7
- data/lib/remarkable_rails/action_view.rb +18 -18
- data/lib/remarkable_rails/active_orm.rb +19 -19
- data/lib/remarkable_rails.rb +30 -30
- data/locale/en.yml +110 -110
- data/spec/action_controller/assign_to_matcher_spec.rb +142 -142
- data/spec/action_controller/filter_params_matcher_spec.rb +64 -64
- data/spec/action_controller/macro_stubs_spec.rb +234 -208
- data/spec/action_controller/redirect_to_matcher_spec.rb +102 -102
- data/spec/action_controller/render_template_matcher_spec.rb +251 -251
- data/spec/action_controller/respond_with_matcher_spec.rb +223 -223
- data/spec/action_controller/route_matcher_spec.rb +96 -79
- data/spec/action_controller/set_cookies_matcher_spec.rb +149 -149
- data/spec/action_controller/set_session_matcher_spec.rb +141 -141
- data/spec/action_controller/set_the_flash_matcher_spec.rb +93 -93
- data/spec/application/application.rb +15 -15
- data/spec/application/tasks_controller.rb +34 -34
- data/spec/functional_builder.rb +88 -88
- data/spec/rcov.opts +2 -2
- data/spec/remarkable_rails_spec.rb +5 -5
- data/spec/spec.opts +4 -4
- data/spec/spec_helper.rb +42 -42
- metadata +7 -7
@@ -1,148 +1,148 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe 'assign_to' do
|
4
|
-
include FunctionalBuilder
|
5
|
-
|
6
|
-
describe 'messages' do
|
7
|
-
before(:each) do
|
8
|
-
@matcher = assign_to(:user).with('jose').with_kind_of(String)
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'should contain a description message' do
|
12
|
-
@matcher = assign_to(:user)
|
13
|
-
@matcher.description.should == 'assign user'
|
14
|
-
|
15
|
-
@matcher.with_kind_of(String)
|
16
|
-
@matcher.description.should == 'assign user with kind of String'
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should set assigned_value? message' do
|
20
|
-
build_response
|
21
|
-
@matcher = assign_to(:user)
|
22
|
-
@matcher.matches?(@controller)
|
23
|
-
@matcher.failure_message.should == 'Expected action to assign user, got no assignment'
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should set is_kind_of? message' do
|
27
|
-
build_response { @user = 1 }
|
28
|
-
@matcher.matches?(@controller)
|
29
|
-
@matcher.failure_message.should == 'Expected assign user to be kind of String, got a Fixnum'
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'should set is_equal_value? message' do
|
33
|
-
build_response { @user = 'joseph' }
|
34
|
-
@matcher.matches?(@controller)
|
35
|
-
@matcher.failure_message.should == 'Expected assign user to be equal to "jose", got "joseph"'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'matcher' do
|
40
|
-
before(:each) do
|
41
|
-
build_response {
|
42
|
-
@user = 'jose'
|
43
|
-
@true = true
|
44
|
-
@false = false
|
45
|
-
@nil = nil
|
46
|
-
}
|
47
|
-
end
|
48
|
-
|
49
|
-
it { should assign_to(:user) }
|
50
|
-
it { should assign_to(:user).with('jose') }
|
51
|
-
it { should assign_to(:user).with_kind_of(String) }
|
52
|
-
|
53
|
-
it { should_not assign_to(:post) }
|
54
|
-
it { should_not assign_to(:user).with('joseph') }
|
55
|
-
it { should_not assign_to(:user).with_kind_of(Fixnum) }
|
56
|
-
|
57
|
-
it { should assign_to(:user){ 'jose' } }
|
58
|
-
it { should assign_to(:user, :with => proc{ 'jose' }) }
|
59
|
-
|
60
|
-
it { should_not assign_to(:user).with(nil) }
|
61
|
-
it { should_not assign_to(:user){ 'joseph' } }
|
62
|
-
it { should_not assign_to(:user, :with => proc{ 'joseph' }) }
|
63
|
-
|
64
|
-
it { should assign_to(:true) }
|
65
|
-
it { should assign_to(:true).with(true) }
|
66
|
-
it { should_not assign_to(:true).with(false) }
|
67
|
-
|
68
|
-
it { should assign_to(:false) }
|
69
|
-
it { should assign_to(:false).with(false) }
|
70
|
-
it { should_not assign_to(:false).with(true) }
|
71
|
-
|
72
|
-
it { should assign_to(:nil) }
|
73
|
-
it { should assign_to(:nil).with(nil) }
|
74
|
-
it { should_not assign_to(:nil).with(true) }
|
75
|
-
end
|
76
|
-
|
77
|
-
describe 'macro' do
|
78
|
-
before(:each) do
|
79
|
-
build_response {
|
80
|
-
@user = 'jose'
|
81
|
-
@true = true
|
82
|
-
@false = false
|
83
|
-
@nil = nil
|
84
|
-
}
|
85
|
-
end
|
86
|
-
|
87
|
-
should_assign_to :user
|
88
|
-
should_assign_to :user, :with => 'jose'
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe 'assign_to' do
|
4
|
+
include FunctionalBuilder
|
5
|
+
|
6
|
+
describe 'messages' do
|
7
|
+
before(:each) do
|
8
|
+
@matcher = assign_to(:user).with('jose').with_kind_of(String)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should contain a description message' do
|
12
|
+
@matcher = assign_to(:user)
|
13
|
+
@matcher.description.should == 'assign user'
|
14
|
+
|
15
|
+
@matcher.with_kind_of(String)
|
16
|
+
@matcher.description.should == 'assign user with kind of String'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should set assigned_value? message' do
|
20
|
+
build_response
|
21
|
+
@matcher = assign_to(:user)
|
22
|
+
@matcher.matches?(@controller)
|
23
|
+
@matcher.failure_message.should == 'Expected action to assign user, got no assignment'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should set is_kind_of? message' do
|
27
|
+
build_response { @user = 1 }
|
28
|
+
@matcher.matches?(@controller)
|
29
|
+
@matcher.failure_message.should == 'Expected assign user to be kind of String, got a Fixnum'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should set is_equal_value? message' do
|
33
|
+
build_response { @user = 'joseph' }
|
34
|
+
@matcher.matches?(@controller)
|
35
|
+
@matcher.failure_message.should == 'Expected assign user to be equal to "jose", got "joseph"'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'matcher' do
|
40
|
+
before(:each) do
|
41
|
+
build_response {
|
42
|
+
@user = 'jose'
|
43
|
+
@true = true
|
44
|
+
@false = false
|
45
|
+
@nil = nil
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
it { should assign_to(:user) }
|
50
|
+
it { should assign_to(:user).with('jose') }
|
51
|
+
it { should assign_to(:user).with_kind_of(String) }
|
52
|
+
|
53
|
+
it { should_not assign_to(:post) }
|
54
|
+
it { should_not assign_to(:user).with('joseph') }
|
55
|
+
it { should_not assign_to(:user).with_kind_of(Fixnum) }
|
56
|
+
|
57
|
+
it { should assign_to(:user){ 'jose' } }
|
58
|
+
it { should assign_to(:user, :with => proc{ 'jose' }) }
|
59
|
+
|
60
|
+
it { should_not assign_to(:user).with(nil) }
|
61
|
+
it { should_not assign_to(:user){ 'joseph' } }
|
62
|
+
it { should_not assign_to(:user, :with => proc{ 'joseph' }) }
|
63
|
+
|
64
|
+
it { should assign_to(:true) }
|
65
|
+
it { should assign_to(:true).with(true) }
|
66
|
+
it { should_not assign_to(:true).with(false) }
|
67
|
+
|
68
|
+
it { should assign_to(:false) }
|
69
|
+
it { should assign_to(:false).with(false) }
|
70
|
+
it { should_not assign_to(:false).with(true) }
|
71
|
+
|
72
|
+
it { should assign_to(:nil) }
|
73
|
+
it { should assign_to(:nil).with(nil) }
|
74
|
+
it { should_not assign_to(:nil).with(true) }
|
75
|
+
end
|
76
|
+
|
77
|
+
describe 'macro' do
|
78
|
+
before(:each) do
|
79
|
+
build_response {
|
80
|
+
@user = 'jose'
|
81
|
+
@true = true
|
82
|
+
@false = false
|
83
|
+
@nil = nil
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
|
+
should_assign_to :user
|
88
|
+
should_assign_to :user, :with => 'jose'
|
89
89
|
should_assign_to :user, :with_kind_of => String
|
90
90
|
|
91
91
|
should_assign_to :user do |m|
|
92
92
|
m.with { 'jose' }
|
93
93
|
m.with_kind_of String
|
94
94
|
end
|
95
|
-
|
96
|
-
should_not_assign_to :post
|
97
|
-
should_not_assign_to :user, :with => 'joseph'
|
98
|
-
should_not_assign_to :user, :with_kind_of => Fixnum
|
99
|
-
|
100
|
-
should_assign_to(:user){ 'jose' }
|
101
|
-
should_assign_to :user, :with => proc{ 'jose' }
|
102
|
-
|
103
|
-
should_not_assign_to :user, :with => nil
|
104
|
-
should_not_assign_to(:user){ 'joseph' }
|
105
|
-
should_not_assign_to :user, :with => proc{ 'joseph' }
|
106
|
-
|
107
|
-
should_assign_to :true
|
108
|
-
should_assign_to :true, :with => true
|
109
|
-
should_not_assign_to :true, :with => false
|
110
|
-
|
111
|
-
should_assign_to :false
|
112
|
-
should_assign_to :false, :with => false
|
113
|
-
should_not_assign_to :false, :with => true
|
114
|
-
|
115
|
-
should_assign_to :nil
|
116
|
-
should_assign_to :nil, :with => nil
|
117
|
-
should_not_assign_to :nil, :with => true
|
118
|
-
end
|
119
|
-
|
120
|
-
describe 'macro stubs' do
|
121
|
-
before(:each) do
|
122
|
-
@controller = TasksController.new
|
123
|
-
@request = ActionController::TestRequest.new
|
124
|
-
@response = ActionController::TestResponse.new
|
125
|
-
end
|
126
|
-
|
127
|
-
expects :new, :on => String, :with => 'ola', :returns => 'ola'
|
128
|
-
get :new
|
129
|
-
|
130
|
-
it 'should run expectations by default' do
|
131
|
-
String.should_receive(:should_receive).with(:new).and_return(@mock=mock('chain'))
|
132
|
-
@mock.should_receive(:with).with('ola').and_return(@mock)
|
133
|
-
@mock.should_receive(:exactly).with(1).and_return(@mock)
|
134
|
-
@mock.should_receive(:times).and_return(@mock)
|
135
|
-
@mock.should_receive(:and_return).with('ola').and_return('ola')
|
136
|
-
|
137
|
-
assign_to(:user).matches?(@controller)
|
138
|
-
end
|
139
|
-
|
140
|
-
it 'should run stubs' do
|
141
|
-
String.should_receive(:stub!).with(:new).and_return(@mock=mock('chain'))
|
142
|
-
@mock.should_receive(:and_return).with('ola').and_return('ola')
|
143
|
-
|
144
|
-
assign_to(:user, :with_stubs => true).matches?(@controller)
|
145
|
-
end
|
146
|
-
|
147
|
-
end
|
148
|
-
end
|
95
|
+
|
96
|
+
should_not_assign_to :post
|
97
|
+
should_not_assign_to :user, :with => 'joseph'
|
98
|
+
should_not_assign_to :user, :with_kind_of => Fixnum
|
99
|
+
|
100
|
+
should_assign_to(:user){ 'jose' }
|
101
|
+
should_assign_to :user, :with => proc{ 'jose' }
|
102
|
+
|
103
|
+
should_not_assign_to :user, :with => nil
|
104
|
+
should_not_assign_to(:user){ 'joseph' }
|
105
|
+
should_not_assign_to :user, :with => proc{ 'joseph' }
|
106
|
+
|
107
|
+
should_assign_to :true
|
108
|
+
should_assign_to :true, :with => true
|
109
|
+
should_not_assign_to :true, :with => false
|
110
|
+
|
111
|
+
should_assign_to :false
|
112
|
+
should_assign_to :false, :with => false
|
113
|
+
should_not_assign_to :false, :with => true
|
114
|
+
|
115
|
+
should_assign_to :nil
|
116
|
+
should_assign_to :nil, :with => nil
|
117
|
+
should_not_assign_to :nil, :with => true
|
118
|
+
end
|
119
|
+
|
120
|
+
describe 'macro stubs' do
|
121
|
+
before(:each) do
|
122
|
+
@controller = TasksController.new
|
123
|
+
@request = ActionController::TestRequest.new
|
124
|
+
@response = ActionController::TestResponse.new
|
125
|
+
end
|
126
|
+
|
127
|
+
expects :new, :on => String, :with => 'ola', :returns => 'ola'
|
128
|
+
get :new
|
129
|
+
|
130
|
+
it 'should run expectations by default' do
|
131
|
+
String.should_receive(:should_receive).with(:new).and_return(@mock=mock('chain'))
|
132
|
+
@mock.should_receive(:with).with('ola').and_return(@mock)
|
133
|
+
@mock.should_receive(:exactly).with(1).and_return(@mock)
|
134
|
+
@mock.should_receive(:times).and_return(@mock)
|
135
|
+
@mock.should_receive(:and_return).with('ola').and_return('ola')
|
136
|
+
|
137
|
+
assign_to(:user).matches?(@controller)
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'should run stubs' do
|
141
|
+
String.should_receive(:stub!).with(:new).and_return(@mock=mock('chain'))
|
142
|
+
@mock.should_receive(:and_return).with('ola').and_return('ola')
|
143
|
+
|
144
|
+
assign_to(:user, :with_stubs => true).matches?(@controller)
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
end
|
@@ -1,64 +1,64 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe 'filter_params' do
|
4
|
-
include FunctionalBuilder
|
5
|
-
|
6
|
-
describe 'messages' do
|
7
|
-
before(:each) do
|
8
|
-
@controller = define_controller :Posts do
|
9
|
-
filter_parameter_logging :password
|
10
|
-
end.new
|
11
|
-
|
12
|
-
@matcher = filter_params(:user)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'should contain a description message' do
|
16
|
-
@matcher.description.should == 'filter user parameters from log'
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'should set respond_to_filter_params? message' do
|
20
|
-
@controller = define_controller(:Comments).new
|
21
|
-
@matcher.matches?(@controller)
|
22
|
-
@matcher.failure_message.should == 'Expected controller to respond to filter_parameters (controller is not filtering any parameter)'
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should set is_filtered? message' do
|
26
|
-
@matcher.matches?(@controller)
|
27
|
-
@matcher.failure_message.should == 'Expected user to be filtered, got no filtering'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
describe 'filtering parameter' do
|
32
|
-
before(:each) do
|
33
|
-
@controller = define_controller :Comments do
|
34
|
-
filter_parameter_logging :password
|
35
|
-
end.new
|
36
|
-
|
37
|
-
self.class.subject { @controller }
|
38
|
-
end
|
39
|
-
|
40
|
-
should_filter_params
|
41
|
-
should_filter_params(:password)
|
42
|
-
should_not_filter_params(:user)
|
43
|
-
|
44
|
-
it { should filter_params }
|
45
|
-
it { should filter_params(:password) }
|
46
|
-
it { should_not filter_params(:user) }
|
47
|
-
end
|
48
|
-
|
49
|
-
describe 'not filtering any parameter' do
|
50
|
-
before(:each) do
|
51
|
-
@controller = define_controller(:Comments).new
|
52
|
-
self.class.subject { @controller }
|
53
|
-
end
|
54
|
-
|
55
|
-
should_not_filter_params
|
56
|
-
should_not_filter_params(:password)
|
57
|
-
should_not_filter_params(:user)
|
58
|
-
|
59
|
-
it { should_not filter_params }
|
60
|
-
it { should_not filter_params(:user) }
|
61
|
-
it { should_not filter_params(:password) }
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe 'filter_params' do
|
4
|
+
include FunctionalBuilder
|
5
|
+
|
6
|
+
describe 'messages' do
|
7
|
+
before(:each) do
|
8
|
+
@controller = define_controller :Posts do
|
9
|
+
filter_parameter_logging :password
|
10
|
+
end.new
|
11
|
+
|
12
|
+
@matcher = filter_params(:user)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should contain a description message' do
|
16
|
+
@matcher.description.should == 'filter user parameters from log'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should set respond_to_filter_params? message' do
|
20
|
+
@controller = define_controller(:Comments).new
|
21
|
+
@matcher.matches?(@controller)
|
22
|
+
@matcher.failure_message.should == 'Expected controller to respond to filter_parameters (controller is not filtering any parameter)'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should set is_filtered? message' do
|
26
|
+
@matcher.matches?(@controller)
|
27
|
+
@matcher.failure_message.should == 'Expected user to be filtered, got no filtering'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'filtering parameter' do
|
32
|
+
before(:each) do
|
33
|
+
@controller = define_controller :Comments do
|
34
|
+
filter_parameter_logging :password
|
35
|
+
end.new
|
36
|
+
|
37
|
+
self.class.subject { @controller }
|
38
|
+
end
|
39
|
+
|
40
|
+
should_filter_params
|
41
|
+
should_filter_params(:password)
|
42
|
+
should_not_filter_params(:user)
|
43
|
+
|
44
|
+
it { should filter_params }
|
45
|
+
it { should filter_params(:password) }
|
46
|
+
it { should_not filter_params(:user) }
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'not filtering any parameter' do
|
50
|
+
before(:each) do
|
51
|
+
@controller = define_controller(:Comments).new
|
52
|
+
self.class.subject { @controller }
|
53
|
+
end
|
54
|
+
|
55
|
+
should_not_filter_params
|
56
|
+
should_not_filter_params(:password)
|
57
|
+
should_not_filter_params(:user)
|
58
|
+
|
59
|
+
it { should_not filter_params }
|
60
|
+
it { should_not filter_params(:user) }
|
61
|
+
it { should_not filter_params(:password) }
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|