remarkable_rails 3.1.8 → 3.1.9
Sign up to get free protection for your applications and to get access to all the features.
- 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,102 +1,102 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe 'redirect_to' do
|
4
|
-
include FunctionalBuilder
|
5
|
-
|
6
|
-
describe 'messages' do
|
7
|
-
before(:each) do
|
8
|
-
build_response { redirect_to projects_url }
|
9
|
-
@matcher = redirect_to(project_tasks_url(1)).with(302)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should contain a description message' do
|
13
|
-
@matcher = redirect_to(project_tasks_url(1))
|
14
|
-
@matcher.description.should == 'redirect to "http://test.host/projects/1/tasks"'
|
15
|
-
|
16
|
-
@matcher.with(301)
|
17
|
-
@matcher.description.should == 'redirect to "http://test.host/projects/1/tasks" with status 301'
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'should set redirected? message' do
|
21
|
-
build_response
|
22
|
-
@matcher.matches?(@controller)
|
23
|
-
@matcher.failure_message.should == 'Expected redirect to "http://test.host/projects/1/tasks", got no redirect'
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'should set status_matches? message' do
|
27
|
-
@matcher.with(200).matches?(@controller)
|
28
|
-
@matcher.failure_message.should == 'Expected redirect to "http://test.host/projects/1/tasks" with status 200, got status 302'
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should set url_matches? message' do
|
32
|
-
@matcher.matches?(@controller)
|
33
|
-
@matcher.failure_message.should == 'Expected redirect to "http://test.host/projects/1/tasks", got redirect to "http://test.host/projects"'
|
34
|
-
end
|
35
|
-
end
|
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|
|
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
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
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|
|
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
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
generate_macro_stubs_specs_for(:redirect_to, 'http://google.com/')
|
102
|
-
end
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe 'redirect_to' do
|
4
|
+
include FunctionalBuilder
|
5
|
+
|
6
|
+
describe 'messages' do
|
7
|
+
before(:each) do
|
8
|
+
build_response { redirect_to projects_url }
|
9
|
+
@matcher = redirect_to(project_tasks_url(1)).with(302)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should contain a description message' do
|
13
|
+
@matcher = redirect_to(project_tasks_url(1))
|
14
|
+
@matcher.description.should == 'redirect to "http://test.host/projects/1/tasks"'
|
15
|
+
|
16
|
+
@matcher.with(301)
|
17
|
+
@matcher.description.should == 'redirect to "http://test.host/projects/1/tasks" with status 301'
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should set redirected? message' do
|
21
|
+
build_response
|
22
|
+
@matcher.matches?(@controller)
|
23
|
+
@matcher.failure_message.should == 'Expected redirect to "http://test.host/projects/1/tasks", got no redirect'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should set status_matches? message' do
|
27
|
+
@matcher.with(200).matches?(@controller)
|
28
|
+
@matcher.failure_message.should == 'Expected redirect to "http://test.host/projects/1/tasks" with status 200, got status 302'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should set url_matches? message' do
|
32
|
+
@matcher.matches?(@controller)
|
33
|
+
@matcher.failure_message.should == 'Expected redirect to "http://test.host/projects/1/tasks", got redirect to "http://test.host/projects"'
|
34
|
+
end
|
35
|
+
end
|
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|
|
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
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
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|
|
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
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
generate_macro_stubs_specs_for(:redirect_to, 'http://google.com/')
|
102
|
+
end
|