Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 8474e9d602
Fetching contributors…

Cannot retrieve contributors at this time

45 lines (37 sloc) 1.258 kb
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
expect(controller.request.path_parameters[:controller]).to 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
expect(controller.request.path_parameters[:action]).to 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
expect(controller.request.path_parameters[:action]).to be_nil
end
end
"""
When I run `rspec spec/views`
Then the examples should all pass
Jump to Line
Something went wrong with that request. Please try again.