Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 45 lines (37 sloc) 1.246 kb
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 44
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

Something went wrong with that request. Please try again.