-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
inferred_controller_path.feature
44 lines (37 loc) · 1.22 KB
/
inferred_controller_path.feature
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
Feature: view spec infers controller path and action
Scenario: infer controller path
Given a file named "spec/views/widgets/new.html.erb_spec.rb" with:
"""
require "spec_helper"
describe "widgets/new" do
it "infers the controller path" do
controller.request.path_parameters[:controller].should eq("widgets")
end
end
"""
When I run `rspec spec/views`
Then the examples should all pass
Scenario: infer action
Given a file named "spec/views/widgets/new.html.erb_spec.rb" with:
"""
require "spec_helper"
describe "widgets/new" do
it "infers the controller path" do
controller.request.path_parameters[:action].should eq("new")
end
end
"""
When I run `rspec spec/views`
Then the examples should all pass
Scenario: do not infer action in a partial
Given a file named "spec/views/widgets/_form.html.erb_spec.rb" with:
"""
require "spec_helper"
describe "widgets/_form" do
it "includes a link to new" do
controller.request.path_parameters[:action].should be_nil
end
end
"""
When I run `rspec spec/views`
Then the examples should all pass