remarkable_rails 3.0.1 → 3.0.2

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.
Files changed (31) hide show
  1. data/CHANGELOG +44 -44
  2. data/LICENSE +1 -1
  3. data/README +83 -83
  4. data/lib/remarkable_rails/action_controller/base.rb +24 -24
  5. data/lib/remarkable_rails/action_controller/macro_stubs.rb +493 -493
  6. data/lib/remarkable_rails/action_controller/matchers/assign_to_matcher.rb +72 -72
  7. data/lib/remarkable_rails/action_controller/matchers/filter_params_matcher.rb +21 -21
  8. data/lib/remarkable_rails/action_controller/matchers/redirect_to_matcher.rb +112 -112
  9. data/lib/remarkable_rails/action_controller/matchers/render_template_matcher.rb +140 -140
  10. data/lib/remarkable_rails/action_controller/matchers/respond_with_matcher.rb +118 -118
  11. data/lib/remarkable_rails/action_controller/matchers/route_matcher.rb +51 -51
  12. data/lib/remarkable_rails/action_controller/matchers/set_session_matcher.rb +103 -103
  13. data/lib/remarkable_rails/action_controller/matchers/set_the_flash_matcher.rb +50 -50
  14. data/lib/remarkable_rails/action_view/base.rb +1 -1
  15. data/lib/remarkable_rails/action_view.rb +16 -16
  16. data/lib/remarkable_rails/active_orm.rb +2 -2
  17. data/locale/en.yml +74 -74
  18. data/spec/action_controller/assign_to_matcher_spec.rb +68 -68
  19. data/spec/action_controller/filter_params_matcher_spec.rb +42 -42
  20. data/spec/action_controller/macro_stubs_spec.rb +17 -17
  21. data/spec/action_controller/redirect_to_matcher_spec.rb +60 -60
  22. data/spec/action_controller/render_template_matcher_spec.rb +227 -227
  23. data/spec/action_controller/respond_with_matcher_spec.rb +189 -189
  24. data/spec/action_controller/route_matcher_spec.rb +75 -75
  25. data/spec/action_controller/set_session_matcher_spec.rb +43 -43
  26. data/spec/action_controller/set_the_flash_matcher_spec.rb +1 -1
  27. data/spec/application/application.rb +14 -14
  28. data/spec/application/tasks_controller.rb +34 -34
  29. data/spec/functional_builder.rb +93 -93
  30. data/spec/spec_helper.rb +44 -44
  31. metadata +4 -4
data/locale/en.yml CHANGED
@@ -1,87 +1,87 @@
1
1
  en:
2
2
  remarkable:
3
- action_controller:
4
- responding: "responding to #{{verb}} {{action}}"
3
+ action_controller:
4
+ responding: "responding to #{{verb}} {{action}}"
5
5
  mime_type: "with {{format}}"
6
6
  assign_to:
7
7
  description: "assign {{names}}"
8
8
  expectations:
9
9
  assigned_value: "action to assign {{name}}, got no assignment"
10
- is_kind_of: "assign {{name}} to be kind of {{with_kind_of}}, got a {{assign_class}}"
11
- is_equal_value: "assign {{name}} to be equal to {{with}}, got {{assign_inspect}}"
12
- optionals:
13
- with_kind_of:
14
- positive: "with kind of {{value}}"
15
- filter_params:
16
- description: "filter {{params}} parameters from log"
17
- expectations:
18
- respond_to_filter_params: "controller to respond to filter_parameters (controller is not filtering any parameter)"
19
- is_filtered: "{{param}} to be filtered, got no filtering"
20
- redirect_to:
21
- description: "redirect to {{expected}}"
22
- expectations:
23
- redirected: "redirect to {{expected}}, got no redirect"
24
- status_matches: "redirect to {{expected}} with status {{with}}, got status {{status}}"
25
- url_matches: "redirect to {{expected}}, got redirect to {{actual}}"
26
- optionals:
27
- with:
28
- positive: "with status {{inspect}}"
29
- render_template:
30
- description: "render"
31
- expectations:
32
- rendered: "template {{template}} to be rendered, got no render"
33
- template_matches: "template {{template}} to be rendered, got {{actual_template}}"
34
- layout_matches: "to render with layout {{layout}}, got {{actual_layout}}"
35
- status_matches: "to render with {{with}}, got {{actual_status}}"
36
- body_matches: "to render with body equals to {{body}}, got {{actual_body}}"
37
- content_type_matches: "to render with content type {{content_type}}, got {{actual_content_type}}"
38
- optionals:
39
- template:
40
- positive: "template {{inspect}}"
41
- layout:
42
- positive: "with layout {{inspect}}"
43
- negative: "with no layout"
44
- with:
45
- positive: "with {{value}}"
46
- body:
47
- positive: "with body {{inspect}}"
48
- content_type:
49
- positive: "with content type {{inspect}}"
50
- respond_with:
51
- description: "respond"
52
- expectations:
53
- status_matches: "to respond with {{with}}, got {{actual_status}}"
54
- body_matches: "to respond with body equals to {{body}}, got {{actual_body}}"
55
- content_type_matches: "to respond with content type {{content_type}}, got {{actual_content_type}}"
56
- optionals:
57
- with:
58
- positive: "with {{value}}"
59
- body:
60
- positive: "with body {{inspect}}"
61
- content_type:
62
- positive: "with content type {{inspect}}"
63
- route:
64
- description: "route {{method}} {{path}} to/from {{options}}"
65
- expectations:
66
- map_to_path: "to map {{options}} to {{method}} {{path}}, got {{actual}}"
67
- generate_params: "to generate params {{options}} from {{method}} {{path}}, got {{actual}}"
68
- set_session:
10
+ is_kind_of: "assign {{name}} to be kind of {{with_kind_of}}, got a {{assign_class}}"
11
+ is_equal_value: "assign {{name}} to be equal to {{with}}, got {{assign_inspect}}"
12
+ optionals:
13
+ with_kind_of:
14
+ positive: "with kind of {{value}}"
15
+ filter_params:
16
+ description: "filter {{params}} parameters from log"
17
+ expectations:
18
+ respond_to_filter_params: "controller to respond to filter_parameters (controller is not filtering any parameter)"
19
+ is_filtered: "{{param}} to be filtered, got no filtering"
20
+ redirect_to:
21
+ description: "redirect to {{expected}}"
22
+ expectations:
23
+ redirected: "redirect to {{expected}}, got no redirect"
24
+ status_matches: "redirect to {{expected}} with status {{with}}, got status {{status}}"
25
+ url_matches: "redirect to {{expected}}, got redirect to {{actual}}"
26
+ optionals:
27
+ with:
28
+ positive: "with status {{inspect}}"
29
+ render_template:
30
+ description: "render"
31
+ expectations:
32
+ rendered: "template {{template}} to be rendered, got no render"
33
+ template_matches: "template {{template}} to be rendered, got {{actual_template}}"
34
+ layout_matches: "to render with layout {{layout}}, got {{actual_layout}}"
35
+ status_matches: "to render with {{with}}, got {{actual_status}}"
36
+ body_matches: "to render with body equals to {{body}}, got {{actual_body}}"
37
+ content_type_matches: "to render with content type {{content_type}}, got {{actual_content_type}}"
38
+ optionals:
39
+ template:
40
+ positive: "template {{inspect}}"
41
+ layout:
42
+ positive: "with layout {{inspect}}"
43
+ negative: "with no layout"
44
+ with:
45
+ positive: "with {{value}}"
46
+ body:
47
+ positive: "with body {{inspect}}"
48
+ content_type:
49
+ positive: "with content type {{inspect}}"
50
+ respond_with:
51
+ description: "respond"
52
+ expectations:
53
+ status_matches: "to respond with {{with}}, got {{actual_status}}"
54
+ body_matches: "to respond with body equals to {{body}}, got {{actual_body}}"
55
+ content_type_matches: "to respond with content type {{content_type}}, got {{actual_content_type}}"
56
+ optionals:
57
+ with:
58
+ positive: "with {{value}}"
59
+ body:
60
+ positive: "with body {{inspect}}"
61
+ content_type:
62
+ positive: "with content type {{inspect}}"
63
+ route:
64
+ description: "route {{method}} {{path}} to/from {{options}}"
65
+ expectations:
66
+ map_to_path: "to map {{options}} to {{method}} {{path}}, got {{actual}}"
67
+ generate_params: "to generate params {{options}} from {{method}} {{path}}, got {{actual}}"
68
+ set_session:
69
69
  description: "set session variable {{keys}}"
70
- expectations:
71
- is_not_empty: "any session variable to be set, got {{session_inspect}}"
70
+ expectations:
71
+ is_not_empty: "any session variable to be set, got {{session_inspect}}"
72
72
  contains_value: "any session variable to be set to {{to}}, got {{session_inspect}}"
73
73
  assigned_value: "session variable {{key}} to be set, got {{session_inspect}}"
74
- is_equal_value: "session variable {{key}} to be set to {{to}}, got {{session_inspect}}"
75
- optionals:
76
- to:
77
- positive: "to {{inspect}}"
78
- set_the_flash:
74
+ is_equal_value: "session variable {{key}} to be set to {{to}}, got {{session_inspect}}"
75
+ optionals:
76
+ to:
77
+ positive: "to {{inspect}}"
78
+ set_the_flash:
79
79
  description: "set the flash message {{keys}}"
80
- expectations:
81
- is_not_empty: "any flash message to be set, got {{flash_inspect}}"
80
+ expectations:
81
+ is_not_empty: "any flash message to be set, got {{flash_inspect}}"
82
82
  contains_value: "any flash message to be set to {{to}}, got {{flash_inspect}}"
83
83
  assigned_value: "flash message {{key}} to be set, got {{flash_inspect}}"
84
- is_equal_value: "flash message {{key}} to be set to {{to}}, got {{flash_inspect}}"
85
- optionals:
86
- to:
87
- positive: "to {{inspect}}"
84
+ is_equal_value: "flash message {{key}} to be set to {{to}}, got {{flash_inspect}}"
85
+ optionals:
86
+ to:
87
+ positive: "to {{inspect}}"
@@ -37,13 +37,13 @@ describe 'assign_to' do
37
37
  end
38
38
 
39
39
  describe 'matcher' do
40
- before(:each) do
41
- build_response {
42
- @user = 'jose'
43
- @true = true
44
- @false = false
45
- @nil = nil
46
- }
40
+ before(:each) do
41
+ build_response {
42
+ @user = 'jose'
43
+ @true = true
44
+ @false = false
45
+ @nil = nil
46
+ }
47
47
  end
48
48
 
49
49
  it { should assign_to(:user) }
@@ -56,32 +56,32 @@ describe 'assign_to' do
56
56
 
57
57
  it { should assign_to(:user){ 'jose' } }
58
58
  it { should assign_to(:user, :with => proc{ 'jose' }) }
59
-
59
+
60
60
  it { should_not assign_to(:user).with(nil) }
61
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) }
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
75
  end
76
76
 
77
77
  describe 'macro' do
78
- before(:each) do
79
- build_response {
80
- @user = 'jose'
81
- @true = true
82
- @false = false
83
- @nil = nil
84
- }
78
+ before(:each) do
79
+ build_response {
80
+ @user = 'jose'
81
+ @true = true
82
+ @false = false
83
+ @nil = nil
84
+ }
85
85
  end
86
86
 
87
87
  should_assign_to :user
@@ -97,47 +97,47 @@ describe 'assign_to' do
97
97
 
98
98
  should_not_assign_to :user, :with => nil
99
99
  should_not_assign_to(:user){ 'joseph' }
100
- should_not_assign_to :user, :with => proc{ 'joseph' }
101
-
102
- should_assign_to :true
103
- should_assign_to :true, :with => true
104
- should_not_assign_to :true, :with => false
105
-
106
- should_assign_to :false
107
- should_assign_to :false, :with => false
108
- should_not_assign_to :false, :with => true
109
-
110
- should_assign_to :nil
111
- should_assign_to :nil, :with => nil
100
+ should_not_assign_to :user, :with => proc{ 'joseph' }
101
+
102
+ should_assign_to :true
103
+ should_assign_to :true, :with => true
104
+ should_not_assign_to :true, :with => false
105
+
106
+ should_assign_to :false
107
+ should_assign_to :false, :with => false
108
+ should_not_assign_to :false, :with => true
109
+
110
+ should_assign_to :nil
111
+ should_assign_to :nil, :with => nil
112
112
  should_not_assign_to :nil, :with => true
113
113
  end
114
-
115
- describe 'macro stubs' do
116
- before(:each) do
117
- @controller = TasksController.new
118
- @request = ActionController::TestRequest.new
119
- @response = ActionController::TestResponse.new
120
- end
121
-
122
- expects :new, :on => String, :with => 'ola', :returns => 'ola'
123
- get :new
124
-
125
- it 'should run expectations by default' do
126
- String.should_receive(:should_receive).with(:new).and_return(@mock=mock('chain'))
127
- @mock.should_receive(:with).with('ola').and_return(@mock)
128
- @mock.should_receive(:exactly).with(1).and_return(@mock)
129
- @mock.should_receive(:times).and_return(@mock)
130
- @mock.should_receive(:and_return).with('ola').and_return('ola')
131
-
132
- assign_to(:user).matches?(@controller)
133
- end
134
-
135
- it 'should run stubs' do
136
- String.should_receive(:stub!).with(:new).and_return(@mock=mock('chain'))
137
- @mock.should_receive(:and_return).with('ola').and_return('ola')
138
-
139
- assign_to(:user, :with_stubs => true).matches?(@controller)
140
- end
141
-
114
+
115
+ describe 'macro stubs' do
116
+ before(:each) do
117
+ @controller = TasksController.new
118
+ @request = ActionController::TestRequest.new
119
+ @response = ActionController::TestResponse.new
120
+ end
121
+
122
+ expects :new, :on => String, :with => 'ola', :returns => 'ola'
123
+ get :new
124
+
125
+ it 'should run expectations by default' do
126
+ String.should_receive(:should_receive).with(:new).and_return(@mock=mock('chain'))
127
+ @mock.should_receive(:with).with('ola').and_return(@mock)
128
+ @mock.should_receive(:exactly).with(1).and_return(@mock)
129
+ @mock.should_receive(:times).and_return(@mock)
130
+ @mock.should_receive(:and_return).with('ola').and_return('ola')
131
+
132
+ assign_to(:user).matches?(@controller)
133
+ end
134
+
135
+ it 'should run stubs' do
136
+ String.should_receive(:stub!).with(:new).and_return(@mock=mock('chain'))
137
+ @mock.should_receive(:and_return).with('ola').and_return('ola')
138
+
139
+ assign_to(:user, :with_stubs => true).matches?(@controller)
140
+ end
141
+
142
142
  end
143
143
  end
@@ -3,62 +3,62 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
3
  describe 'filter_params' do
4
4
  include FunctionalBuilder
5
5
 
6
- describe 'messages' do
7
- before(:each) do
8
- @controller = define_controller :Posts do
9
- filter_parameter_logging :password
10
- end.new
6
+ describe 'messages' do
7
+ before(:each) do
8
+ @controller = define_controller :Posts do
9
+ filter_parameter_logging :password
10
+ end.new
11
11
 
12
12
  @matcher = filter_params(:user)
13
- end
13
+ end
14
14
 
15
15
  it 'should contain a description message' do
16
16
  @matcher.description.should == 'filter user parameters from log'
17
17
  end
18
18
 
19
- it 'should set respond_to_filter_params? message' do
20
- @controller = define_controller(:Comments).new
21
- @matcher.matches?(@controller)
19
+ it 'should set respond_to_filter_params? message' do
20
+ @controller = define_controller(:Comments).new
21
+ @matcher.matches?(@controller)
22
22
  @matcher.failure_message.should == 'Expected controller to respond to filter_parameters (controller is not filtering any parameter)'
23
23
  end
24
24
 
25
- it 'should set is_filtered? message' do
26
- @matcher.matches?(@controller)
25
+ it 'should set is_filtered? message' do
26
+ @matcher.matches?(@controller)
27
27
  @matcher.failure_message.should == 'Expected user to be filtered, got no filtering'
28
28
  end
29
29
  end
30
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 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) }
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 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
62
  end
63
63
 
64
64
  end
@@ -126,27 +126,27 @@ describe 'MacroStubs' do
126
126
  end
127
127
 
128
128
  describe 'and running actions in a before(:all) filter' do
129
- get :show, :id => 37
130
-
131
- get! do
132
- @request.should_not be_nil
133
- end
134
-
135
- get! do
136
- @flag = true
137
- end
138
-
139
- get! do
140
- @controller.should_not be_nil
129
+ get :show, :id => 37
130
+
131
+ get! do
132
+ @request.should_not be_nil
133
+ end
134
+
135
+ get! do
136
+ @flag = true
137
+ end
138
+
139
+ get! do
140
+ @controller.should_not be_nil
141
141
  end
142
142
 
143
143
  it 'should run the action before each example' do
144
144
  @controller.send(:performed?).should be_true
145
- end
146
-
147
- it 'should execute the given block' do
148
- @flag.should be_true
149
- end
145
+ end
146
+
147
+ it 'should execute the given block' do
148
+ @flag.should be_true
149
+ end
150
150
  end
151
151
  end
152
152
 
@@ -4,12 +4,12 @@ describe 'redirect_to' do
4
4
  include FunctionalBuilder
5
5
 
6
6
  describe 'messages' do
7
- before(:each) do
8
- build_response { redirect_to projects_url }
7
+ before(:each) do
8
+ build_response { redirect_to projects_url }
9
9
  @matcher = redirect_to(project_tasks_url(1)).with(302)
10
10
  end
11
11
 
12
- it 'should contain a description message' do
12
+ it 'should contain a description message' do
13
13
  @matcher = redirect_to(project_tasks_url(1))
14
14
  @matcher.description.should == 'redirect to "http://test.host/projects/1/tasks"'
15
15
 
@@ -17,13 +17,13 @@ describe 'redirect_to' do
17
17
  @matcher.description.should == 'redirect to "http://test.host/projects/1/tasks" with status 301'
18
18
  end
19
19
 
20
- it 'should set redirected? message' do
21
- build_response
20
+ it 'should set redirected? message' do
21
+ build_response
22
22
  @matcher.matches?(@controller)
23
23
  @matcher.failure_message.should == 'Expected redirect to "http://test.host/projects/1/tasks", got no redirect'
24
24
  end
25
25
 
26
- it 'should set status_matches? message' do
26
+ it 'should set status_matches? message' do
27
27
  @matcher.with(200).matches?(@controller)
28
28
  @matcher.failure_message.should == 'Expected redirect to "http://test.host/projects/1/tasks" with status 200, got status 302'
29
29
  end
@@ -34,69 +34,69 @@ describe 'redirect_to' do
34
34
  end
35
35
  end
36
36
 
37
- describe 'matcher' do
38
-
39
- {
40
- :hash => { :controller => 'tasks', :action => 'index', :project_id => 1 },
41
- :url => 'http://test.host/projects/1/tasks',
42
- :path => '/projects/1/tasks'
43
- }.each do |type, route|
37
+ describe 'matcher' do
38
+
39
+ {
40
+ :hash => { :controller => 'tasks', :action => 'index', :project_id => 1 },
41
+ :url => 'http://test.host/projects/1/tasks',
42
+ :path => '/projects/1/tasks'
43
+ }.each do |type, route|
44
44
  describe "redirecting to an #{type}" do
45
- before(:each){ build_response { redirect_to route } }
46
-
47
- it { should redirect_to(project_tasks_url(1)) }
48
- it { should redirect_to(project_tasks_path(1)) }
49
- it { should redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1) }
50
- it { should redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1).with(302) }
51
-
52
- it { should_not redirect_to(project_tasks_url(2)) }
53
- it { should_not redirect_to(project_tasks_path(2)) }
54
- it { should_not redirect_to(:controller => 'tasks', :action => 'index', :project_id => 2) }
55
- it { should_not redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1).with(301) }
56
-
57
- it { response.should redirect_to(project_tasks_url(1)) }
58
- it { response.should redirect_to(project_tasks_path(1)) }
59
- it { response.should redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1) }
60
- it { response.should redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1).with(302) }
61
-
62
- it { response.should_not redirect_to(project_tasks_url(2)) }
63
- it { response.should_not redirect_to(project_tasks_path(2)) }
64
- it { response.should_not redirect_to(:controller => 'tasks', :action => 'index', :project_id => 2) }
65
- it { response.should_not redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1).with(301) }
66
- end
45
+ before(:each){ build_response { redirect_to route } }
46
+
47
+ it { should redirect_to(project_tasks_url(1)) }
48
+ it { should redirect_to(project_tasks_path(1)) }
49
+ it { should redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1) }
50
+ it { should redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1).with(302) }
51
+
52
+ it { should_not redirect_to(project_tasks_url(2)) }
53
+ it { should_not redirect_to(project_tasks_path(2)) }
54
+ it { should_not redirect_to(:controller => 'tasks', :action => 'index', :project_id => 2) }
55
+ it { should_not redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1).with(301) }
56
+
57
+ it { response.should redirect_to(project_tasks_url(1)) }
58
+ it { response.should redirect_to(project_tasks_path(1)) }
59
+ it { response.should redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1) }
60
+ it { response.should redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1).with(302) }
61
+
62
+ it { response.should_not redirect_to(project_tasks_url(2)) }
63
+ it { response.should_not redirect_to(project_tasks_path(2)) }
64
+ it { response.should_not redirect_to(:controller => 'tasks', :action => 'index', :project_id => 2) }
65
+ it { response.should_not redirect_to(:controller => 'tasks', :action => 'index', :project_id => 1).with(301) }
66
+ end
67
67
  end
68
68
 
69
69
  end
70
70
 
71
71
  describe 'macro' do
72
-
73
- {
74
- :hash => { :controller => 'tasks', :action => 'index', :project_id => 1 },
75
- :url => 'http://test.host/projects/1/tasks',
76
- :path => '/projects/1/tasks'
77
- }.each do |type, route|
72
+
73
+ {
74
+ :hash => { :controller => 'tasks', :action => 'index', :project_id => 1 },
75
+ :url => 'http://test.host/projects/1/tasks',
76
+ :path => '/projects/1/tasks'
77
+ }.each do |type, route|
78
78
  describe "redirecting to an #{type}" do
79
- before(:each){ build_response { redirect_to route } }
80
-
81
- should_redirect_to{ project_tasks_url(1) }
82
- should_redirect_to{ project_tasks_path(1) }
83
- should_redirect_to proc{ project_tasks_url(1) }
84
- should_redirect_to proc{ project_tasks_path(1) }
85
- should_redirect_to proc{ project_tasks_url(1) }, :with => 302
86
- should_redirect_to proc{ project_tasks_path(1) }, :with => 302
87
- should_redirect_to :controller => 'tasks', :action => 'index', :project_id => 1
88
-
89
- should_not_redirect_to{ project_tasks_url(2) }
90
- should_not_redirect_to{ project_tasks_path(2) }
91
- should_not_redirect_to proc{ project_tasks_url(2) }
92
- should_not_redirect_to proc{ project_tasks_path(2) }
93
- should_not_redirect_to proc{ project_tasks_url(1) }, :with => 301
94
- should_not_redirect_to proc{ project_tasks_path(1) }, :with => 301
95
- should_not_redirect_to :controller => 'tasks', :action => 'index', :project_id => 2
96
- end
79
+ before(:each){ build_response { redirect_to route } }
80
+
81
+ should_redirect_to{ project_tasks_url(1) }
82
+ should_redirect_to{ project_tasks_path(1) }
83
+ should_redirect_to proc{ project_tasks_url(1) }
84
+ should_redirect_to proc{ project_tasks_path(1) }
85
+ should_redirect_to proc{ project_tasks_url(1) }, :with => 302
86
+ should_redirect_to proc{ project_tasks_path(1) }, :with => 302
87
+ should_redirect_to :controller => 'tasks', :action => 'index', :project_id => 1
88
+
89
+ should_not_redirect_to{ project_tasks_url(2) }
90
+ should_not_redirect_to{ project_tasks_path(2) }
91
+ should_not_redirect_to proc{ project_tasks_url(2) }
92
+ should_not_redirect_to proc{ project_tasks_path(2) }
93
+ should_not_redirect_to proc{ project_tasks_url(1) }, :with => 301
94
+ should_not_redirect_to proc{ project_tasks_path(1) }, :with => 301
95
+ should_not_redirect_to :controller => 'tasks', :action => 'index', :project_id => 2
96
+ end
97
97
  end
98
98
 
99
99
  end
100
-
100
+
101
101
  generate_macro_stubs_specs_for(:redirect_to, 'http://google.com/')
102
102
  end