rspec-rails 2.5.0 → 2.6.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -4
- data/.travis.yml +11 -0
- data/README_DEV.md +43 -0
- data/Rakefile +54 -27
- data/Thorfile +6 -21
- data/features/Autotest.md +7 -0
- data/features/Changelog.md +17 -2
- data/features/Upgrade.md +13 -12
- data/features/controller_specs/README.md +18 -10
- data/features/controller_specs/anonymous_controller.feature +5 -5
- data/features/controller_specs/controller_spec.feature +1 -1
- data/features/controller_specs/isolation_from_views.feature +2 -2
- data/features/controller_specs/render_views.feature +3 -3
- data/features/helper_specs/helper_spec.feature +3 -3
- data/features/mailer_specs/url_helpers.feature +2 -2
- data/features/matchers/new_record_matcher.feature +2 -2
- data/features/matchers/redirect_to_matcher.feature +1 -1
- data/features/matchers/render_template_matcher.feature +1 -1
- data/features/mocks/mock_model.feature +21 -5
- data/features/mocks/stub_model.feature +2 -2
- data/features/model_specs/errors_on.feature +1 -1
- data/features/model_specs/transactional_examples.feature +10 -5
- data/features/routing_specs/README.md +2 -1
- data/features/routing_specs/be_routable_matcher.feature +5 -5
- data/features/routing_specs/named_routes.feature +1 -1
- data/features/routing_specs/route_to_matcher.feature +28 -8
- data/features/step_definitions/additional_cli_steps.rb +1 -1
- data/features/support/env.rb +7 -18
- data/features/view_specs/inferred_controller_path.feature +3 -3
- data/features/view_specs/stub_template.feature +2 -2
- data/features/view_specs/view_spec.feature +8 -8
- data/gemfiles/base.rb +45 -0
- data/gemfiles/rails-3-0-stable +7 -0
- data/gemfiles/rails-3.0.0 +5 -0
- data/gemfiles/rails-3.0.1 +5 -0
- data/gemfiles/rails-3.0.2 +5 -0
- data/gemfiles/rails-3.0.3 +5 -0
- data/gemfiles/rails-3.0.4 +5 -0
- data/gemfiles/rails-3.0.5 +5 -0
- data/gemfiles/rails-3.0.6 +5 -0
- data/gemfiles/rails-master +7 -0
- data/lib/generators/rspec/scaffold/scaffold_generator.rb +20 -2
- data/lib/generators/rspec/scaffold/templates/controller_spec.rb +23 -23
- data/lib/generators/rspec/scaffold/templates/edit_spec.rb +7 -7
- data/lib/generators/rspec/scaffold/templates/index_spec.rb +2 -2
- data/lib/generators/rspec/scaffold/templates/new_spec.rb +5 -5
- data/lib/generators/rspec/scaffold/templates/routing_spec.rb +14 -14
- data/lib/generators/rspec/scaffold/templates/show_spec.rb +2 -2
- data/lib/rspec/rails/example/controller_example_group.rb +9 -1
- data/lib/rspec/rails/example/routing_example_group.rb +1 -0
- data/lib/rspec/rails/matchers/routing_matchers.rb +23 -2
- data/lib/rspec/rails/mocks.rb +3 -0
- data/lib/rspec/rails/tasks/rspec.rake +1 -1
- data/lib/rspec/rails/version.rb +1 -1
- data/rspec-rails.gemspec +5 -36
- data/spec/autotest/rails_rspec2_spec.rb +2 -7
- data/spec/rspec/rails/example/controller_example_group_spec.rb +25 -0
- data/spec/rspec/rails/matchers/route_to_spec.rb +15 -0
- data/spec/rspec/rails/mocks/ar_classes.rb +5 -2
- data/spec/rspec/rails/view_rendering_spec.rb +0 -6
- data/templates/generate_stuff.rb +2 -1
- data/templates/run_specs.rb +2 -2
- metadata +54 -77
- data/Gemfile-3-0-stable +0 -6
- data/Gemfile-3.0.0 +0 -3
- data/Gemfile-3.0.3 +0 -3
- data/Gemfile-base +0 -38
- data/Gemfile-master +0 -5
- data/specs.watchr +0 -59
- data/templates/Gemfile-base +0 -17
data/gemfiles/base.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
module GemfileBase
|
2
|
+
def self.extended(host)
|
3
|
+
host.instance_eval do
|
4
|
+
source "http://rubygems.org"
|
5
|
+
|
6
|
+
%w[rspec rspec-core rspec-expectations rspec-mocks rspec-rails].each do |lib|
|
7
|
+
library_path = File.expand_path("../../../#{lib}", __FILE__)
|
8
|
+
if File.exist?(library_path)
|
9
|
+
gem lib, :path => library_path
|
10
|
+
elsif ENV["USE_GIT_REPOS"] == 'true'
|
11
|
+
gem lib, :git => "git://github.com/rspec/#{lib}.git"
|
12
|
+
else
|
13
|
+
gem lib
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
18
|
+
# gem "cucumber", "~> 0.10.2"
|
19
|
+
# gem "aruba", :git => "git://github.com/aslakhellesoy/aruba"
|
20
|
+
gem "rcov", "0.9.9"
|
21
|
+
gem "relish", "0.2.0"
|
22
|
+
gem "guard-rspec", "0.1.9"
|
23
|
+
gem "growl", "1.0.3"
|
24
|
+
gem "ZenTest", "~> 4.4.2"
|
25
|
+
gem "webrat", "0.7.2"
|
26
|
+
|
27
|
+
if RUBY_PLATFORM =~ /darwin/
|
28
|
+
gem "autotest-fsevent", "~> 0.2.4"
|
29
|
+
gem "autotest-growl", "~> 0.2.9"
|
30
|
+
end
|
31
|
+
|
32
|
+
gem "ruby-debug", :platforms => :ruby_18
|
33
|
+
gem "ruby-debug19", "~> 0.11.6", :platforms => :ruby_19
|
34
|
+
|
35
|
+
platforms :ruby_18, :ruby_19 do
|
36
|
+
gem "rb-fsevent", "~> 0.3.9"
|
37
|
+
gem "ruby-prof", "~> 0.9.2"
|
38
|
+
end
|
39
|
+
|
40
|
+
platforms :jruby do
|
41
|
+
gem "jruby-openssl"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require File.expand_path("../base.rb", __FILE__)
|
2
|
+
|
3
|
+
extend GemfileBase
|
4
|
+
|
5
|
+
gem "rails", :git => "git://github.com/rails/rails.git", :branch => "3-0-stable"
|
6
|
+
gem "arel", :git => "git://github.com/rails/arel.git", :branch => "2-0-stable"
|
7
|
+
gem "rack", :git => "git://github.com/rack/rack.git"
|
@@ -65,6 +65,24 @@ module Rspec
|
|
65
65
|
"{'these' => 'params'}"
|
66
66
|
end
|
67
67
|
|
68
|
+
# support for namespaced-resources
|
69
|
+
def ns_file_name
|
70
|
+
if ARGV[0].match(/(\w+)\/(\w+)/)
|
71
|
+
"#{$1.underscore}_#{$2.singularize.underscore}"
|
72
|
+
else
|
73
|
+
file_name
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# support for namespaced-resources
|
78
|
+
def ns_table_name
|
79
|
+
if ARGV[0].match(/(\w+)\/(\w+)/)
|
80
|
+
"#{$1.underscore}/#{$2.tableize}"
|
81
|
+
else
|
82
|
+
table_name
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
68
86
|
# Returns the name of the mock. For example, if the file name is user,
|
69
87
|
# it returns mock_user.
|
70
88
|
#
|
@@ -81,9 +99,9 @@ module Rspec
|
|
81
99
|
if hash
|
82
100
|
method, and_return = hash.to_a.first
|
83
101
|
method = orm_instance.send(method).split('.').last.gsub(/\(.*?\)/, '')
|
84
|
-
"mock_#{
|
102
|
+
"mock_#{ns_file_name}(:#{method} => #{and_return})"
|
85
103
|
else
|
86
|
-
"mock_#{
|
104
|
+
"mock_#{ns_file_name}"
|
87
105
|
end
|
88
106
|
end
|
89
107
|
|
@@ -21,54 +21,54 @@ describe <%= controller_class_name %>Controller do
|
|
21
21
|
|
22
22
|
<% end -%>
|
23
23
|
describe "GET show" do
|
24
|
-
it "assigns the requested <%=
|
24
|
+
it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
|
25
25
|
<%= stub orm_class.find(class_name, "37".inspect) %> { <%= mock_file_name %> }
|
26
26
|
get :show, :id => "37"
|
27
|
-
assigns(:<%=
|
27
|
+
assigns(:<%= ns_file_name %>).should be(<%= mock_file_name %>)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe "GET new" do
|
32
|
-
it "assigns a new <%=
|
32
|
+
it "assigns a new <%= ns_file_name %> as @<%= ns_file_name %>" do
|
33
33
|
<%= stub orm_class.build(class_name) %> { <%= mock_file_name %> }
|
34
34
|
get :new
|
35
|
-
assigns(:<%=
|
35
|
+
assigns(:<%= ns_file_name %>).should be(<%= mock_file_name %>)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "GET edit" do
|
40
|
-
it "assigns the requested <%=
|
40
|
+
it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
|
41
41
|
<%= stub orm_class.find(class_name, "37".inspect) %> { <%= mock_file_name %> }
|
42
42
|
get :edit, :id => "37"
|
43
|
-
assigns(:<%=
|
43
|
+
assigns(:<%= ns_file_name %>).should be(<%= mock_file_name %>)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
describe "POST create" do
|
48
48
|
describe "with valid params" do
|
49
|
-
it "assigns a newly created <%=
|
49
|
+
it "assigns a newly created <%= ns_file_name %> as @<%= ns_file_name %>" do
|
50
50
|
<%= stub orm_class.build(class_name, params) %> { <%= mock_file_name(:save => true) %> }
|
51
|
-
post :create, :<%=
|
52
|
-
assigns(:<%=
|
51
|
+
post :create, :<%= ns_file_name %> => <%= params %>
|
52
|
+
assigns(:<%= ns_file_name %>).should be(<%= mock_file_name %>)
|
53
53
|
end
|
54
54
|
|
55
|
-
it "redirects to the created <%=
|
55
|
+
it "redirects to the created <%= ns_file_name %>" do
|
56
56
|
<%= stub orm_class.build(class_name) %> { <%= mock_file_name(:save => true) %> }
|
57
|
-
post :create, :<%=
|
57
|
+
post :create, :<%= ns_file_name %> => {}
|
58
58
|
response.should redirect_to(<%= table_name.singularize %>_url(<%= mock_file_name %>))
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
describe "with invalid params" do
|
63
|
-
it "assigns a newly created but unsaved <%=
|
63
|
+
it "assigns a newly created but unsaved <%= ns_file_name %> as @<%= ns_file_name %>" do
|
64
64
|
<%= stub orm_class.build(class_name, params) %> { <%= mock_file_name(:save => false) %> }
|
65
|
-
post :create, :<%=
|
66
|
-
assigns(:<%=
|
65
|
+
post :create, :<%= ns_file_name %> => <%= params %>
|
66
|
+
assigns(:<%= ns_file_name %>).should be(<%= mock_file_name %>)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "re-renders the 'new' template" do
|
70
70
|
<%= stub orm_class.build(class_name) %> { <%= mock_file_name(:save => false) %> }
|
71
|
-
post :create, :<%=
|
71
|
+
post :create, :<%= ns_file_name %> => {}
|
72
72
|
response.should render_template("new")
|
73
73
|
end
|
74
74
|
end
|
@@ -76,19 +76,19 @@ describe <%= controller_class_name %>Controller do
|
|
76
76
|
|
77
77
|
describe "PUT update" do
|
78
78
|
describe "with valid params" do
|
79
|
-
it "updates the requested <%=
|
79
|
+
it "updates the requested <%= ns_file_name %>" do
|
80
80
|
<%= stub orm_class.find(class_name, "37".inspect) %> { <%= mock_file_name %> }
|
81
81
|
mock_<%= should_receive orm_instance.update_attributes(params) %>
|
82
|
-
put :update, :id => "37", :<%=
|
82
|
+
put :update, :id => "37", :<%= ns_file_name %> => <%= params %>
|
83
83
|
end
|
84
84
|
|
85
|
-
it "assigns the requested <%=
|
85
|
+
it "assigns the requested <%= ns_file_name %> as @<%= ns_file_name %>" do
|
86
86
|
<%= stub orm_class.find(class_name) %> { <%= mock_file_name(:update_attributes => true) %> }
|
87
87
|
put :update, :id => "1"
|
88
|
-
assigns(:<%=
|
88
|
+
assigns(:<%= ns_file_name %>).should be(<%= mock_file_name %>)
|
89
89
|
end
|
90
90
|
|
91
|
-
it "redirects to the <%=
|
91
|
+
it "redirects to the <%= ns_file_name %>" do
|
92
92
|
<%= stub orm_class.find(class_name) %> { <%= mock_file_name(:update_attributes => true) %> }
|
93
93
|
put :update, :id => "1"
|
94
94
|
response.should redirect_to(<%= table_name.singularize %>_url(<%= mock_file_name %>))
|
@@ -96,10 +96,10 @@ describe <%= controller_class_name %>Controller do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
describe "with invalid params" do
|
99
|
-
it "assigns the <%=
|
99
|
+
it "assigns the <%= ns_file_name %> as @<%= ns_file_name %>" do
|
100
100
|
<%= stub orm_class.find(class_name) %> { <%= mock_file_name(:update_attributes => false) %> }
|
101
101
|
put :update, :id => "1"
|
102
|
-
assigns(:<%=
|
102
|
+
assigns(:<%= ns_file_name %>).should be(<%= mock_file_name %>)
|
103
103
|
end
|
104
104
|
|
105
105
|
it "re-renders the 'edit' template" do
|
@@ -111,7 +111,7 @@ describe <%= controller_class_name %>Controller do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
describe "DELETE destroy" do
|
114
|
-
it "destroys the requested <%=
|
114
|
+
it "destroys the requested <%= ns_file_name %>" do
|
115
115
|
<%= stub orm_class.find(class_name, "37".inspect) %> { <%= mock_file_name %> }
|
116
116
|
mock_<%= should_receive orm_instance.destroy %>
|
117
117
|
delete :destroy, :id => "37"
|
@@ -1,29 +1,29 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
4
|
-
describe "<%=
|
4
|
+
describe "<%= ns_table_name %>/edit.html.<%= options[:template_engine] %>" do
|
5
5
|
before(:each) do
|
6
|
-
@<%=
|
6
|
+
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
|
7
7
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
8
8
|
:<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
9
9
|
<% end -%>
|
10
10
|
<%= output_attributes.empty? ? "" : " ))\n" -%>
|
11
11
|
end
|
12
12
|
|
13
|
-
it "renders the edit <%=
|
13
|
+
it "renders the edit <%= ns_file_name %> form" do
|
14
14
|
render
|
15
15
|
|
16
16
|
<% if webrat? -%>
|
17
|
-
rendered.should have_selector("form", :action => <%=
|
17
|
+
rendered.should have_selector("form", :action => <%= ns_file_name %>_path(@<%= ns_file_name %>), :method => "post") do |form|
|
18
18
|
<% for attribute in output_attributes -%>
|
19
|
-
form.should have_selector("<%= attribute.input_type -%>#<%=
|
19
|
+
form.should have_selector("<%= attribute.input_type -%>#<%= ns_file_name %>_<%= attribute.name %>", :name => "<%= ns_file_name %>[<%= attribute.name %>]")
|
20
20
|
<% end -%>
|
21
21
|
end
|
22
22
|
<% else -%>
|
23
23
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
24
|
-
assert_select "form", :action => <%= index_helper %>_path(@<%=
|
24
|
+
assert_select "form", :action => <%= index_helper %>_path(@<%= ns_file_name %>), :method => "post" do
|
25
25
|
<% for attribute in output_attributes -%>
|
26
|
-
assert_select "<%= attribute.input_type -%>#<%=
|
26
|
+
assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= attribute.name %>", :name => "<%= ns_file_name %>[<%= attribute.name %>]"
|
27
27
|
<% end -%>
|
28
28
|
end
|
29
29
|
<% end -%>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
4
|
-
describe "<%=
|
4
|
+
describe "<%= ns_table_name %>/index.html.<%= options[:template_engine] %>" do
|
5
5
|
before(:each) do
|
6
6
|
assign(:<%= table_name %>, [
|
7
7
|
<% [1,2].each_with_index do |id, model_index| -%>
|
@@ -16,7 +16,7 @@ describe "<%= table_name %>/index.html.<%= options[:template_engine] %>" do
|
|
16
16
|
])
|
17
17
|
end
|
18
18
|
|
19
|
-
it "renders a list of <%=
|
19
|
+
it "renders a list of <%= ns_table_name %>" do
|
20
20
|
render
|
21
21
|
<% for attribute in output_attributes -%>
|
22
22
|
<% if webrat? -%>
|
@@ -1,28 +1,28 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
4
|
-
describe "<%=
|
4
|
+
describe "<%= ns_table_name %>/new.html.<%= options[:template_engine] %>" do
|
5
5
|
before(:each) do
|
6
|
-
assign(:<%=
|
6
|
+
assign(:<%= ns_file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? ').as_new_record)' : ',' %>
|
7
7
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
8
8
|
:<%= attribute.name %> => <%= attribute.default.inspect %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
9
9
|
<% end -%>
|
10
10
|
<%= !output_attributes.empty? ? " ).as_new_record)\n end" : " end" %>
|
11
11
|
|
12
|
-
it "renders new <%=
|
12
|
+
it "renders new <%= ns_file_name %> form" do
|
13
13
|
render
|
14
14
|
|
15
15
|
<% if webrat? -%>
|
16
16
|
rendered.should have_selector("form", :action => <%= table_name %>_path, :method => "post") do |form|
|
17
17
|
<% for attribute in output_attributes -%>
|
18
|
-
form.should have_selector("<%= attribute.input_type -%>#<%=
|
18
|
+
form.should have_selector("<%= attribute.input_type -%>#<%= ns_file_name %>_<%= attribute.name %>", :name => "<%= ns_file_name %>[<%= attribute.name %>]")
|
19
19
|
<% end -%>
|
20
20
|
end
|
21
21
|
<% else -%>
|
22
22
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
23
23
|
assert_select "form", :action => <%= index_helper %>_path, :method => "post" do
|
24
24
|
<% for attribute in output_attributes -%>
|
25
|
-
assert_select "<%= attribute.input_type -%>#<%=
|
25
|
+
assert_select "<%= attribute.input_type -%>#<%= ns_file_name %>_<%= attribute.name %>", :name => "<%= ns_file_name %>[<%= attribute.name %>]"
|
26
26
|
<% end -%>
|
27
27
|
end
|
28
28
|
<% end -%>
|
@@ -4,33 +4,33 @@ describe <%= controller_class_name %>Controller do
|
|
4
4
|
describe "routing" do
|
5
5
|
|
6
6
|
<% unless options[:singleton] -%>
|
7
|
-
it "
|
8
|
-
|
7
|
+
it "routes to #index" do
|
8
|
+
get("/<%= ns_table_name %>").should route_to("<%= ns_table_name %>#index")
|
9
9
|
end
|
10
10
|
|
11
11
|
<% end -%>
|
12
|
-
it "
|
13
|
-
|
12
|
+
it "routes to #new" do
|
13
|
+
get("/<%= ns_table_name %>/new").should route_to("<%= ns_table_name %>#new")
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
17
|
-
|
16
|
+
it "routes to #show" do
|
17
|
+
get("/<%= ns_table_name %>/1").should route_to("<%= ns_table_name %>#show", :id => "1")
|
18
18
|
end
|
19
19
|
|
20
|
-
it "
|
21
|
-
|
20
|
+
it "routes to #edit" do
|
21
|
+
get("/<%= ns_table_name %>/1/edit").should route_to("<%= ns_table_name %>#edit", :id => "1")
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
25
|
-
|
24
|
+
it "routes to #create" do
|
25
|
+
post("/<%= ns_table_name %>").should route_to("<%= ns_table_name %>#create")
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
29
|
-
|
28
|
+
it "routes to #update" do
|
29
|
+
put("/<%= ns_table_name %>/1").should route_to("<%= ns_table_name %>#update", :id => "1")
|
30
30
|
end
|
31
31
|
|
32
|
-
it "
|
33
|
-
|
32
|
+
it "routes to #destroy" do
|
33
|
+
delete("/<%= ns_table_name %>/1").should route_to("<%= ns_table_name %>#destroy", :id => "1")
|
34
34
|
end
|
35
35
|
|
36
36
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
<% output_attributes = attributes.reject{|attribute| [:datetime, :timestamp, :time, :date].index(attribute.type) } -%>
|
4
|
-
describe "<%=
|
4
|
+
describe "<%= ns_table_name %>/show.html.<%= options[:template_engine] %>" do
|
5
5
|
before(:each) do
|
6
|
-
@<%=
|
6
|
+
@<%= ns_file_name %> = assign(:<%= ns_file_name %>, stub_model(<%= class_name %><%= output_attributes.empty? ? '))' : ',' %>
|
7
7
|
<% output_attributes.each_with_index do |attribute, attribute_index| -%>
|
8
8
|
:<%= attribute.name %> => <%= value_for(attribute) %><%= attribute_index == output_attributes.length - 1 ? '' : ','%>
|
9
9
|
<% end -%>
|
@@ -148,13 +148,21 @@ module RSpec::Rails
|
|
148
148
|
end
|
149
149
|
|
150
150
|
after do
|
151
|
-
@routes = @orig_routes
|
151
|
+
@routes, @orig_routes = @orig_routes, nil
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
156
|
module InstanceMethods
|
157
157
|
attr_reader :controller, :routes
|
158
|
+
|
159
|
+
def method_missing(method, *args, &block)
|
160
|
+
if @orig_routes && @orig_routes.named_routes.helpers.include?(method)
|
161
|
+
controller.send(method, *args, &block)
|
162
|
+
else
|
163
|
+
super
|
164
|
+
end
|
165
|
+
end
|
158
166
|
end
|
159
167
|
|
160
168
|
included do
|
@@ -6,6 +6,7 @@ module RSpec::Rails
|
|
6
6
|
include RSpec::Rails::RailsExampleGroup
|
7
7
|
include ActionDispatch::Assertions::RoutingAssertions
|
8
8
|
include RSpec::Rails::Matchers::RoutingMatchers
|
9
|
+
include RSpec::Rails::Matchers::RoutingMatchers::RouteHelpers
|
9
10
|
|
10
11
|
module InstanceMethods
|
11
12
|
attr_reader :routes
|