Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render the file named in the outer-most example group description.
Closes #11.
- Loading branch information
1 parent
8a4fa5b
commit 24ca705
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
Feature: view spec | ||
|
||
View specs live in spec/views and render view templates in isolation. | ||
|
||
Scenario: passing spec | ||
Given a file named "spec/views/widgets/index.html.erb_spec.rb" with: | ||
""" | ||
require "spec_helper" | ||
describe "widgets/index.html.erb" do | ||
it "displays all the widgets" do | ||
assign(:widgets, [ | ||
stub_model(Widget, :name => "slicer"), | ||
stub_model(Widget, :name => "dicer") | ||
]) | ||
render | ||
response.should contain("slicer") | ||
response.should contain("dicer") | ||
end | ||
end | ||
""" | ||
When I run "rspec spec/views" | ||
Then I should see "1 example, 0 failures" | ||
|
||
Scenario: passing spec with before and nesting | ||
Given a file named "spec/views/widgets/index.html.erb_spec.rb" with: | ||
""" | ||
require "spec_helper" | ||
describe "widgets/index.html.erb" do | ||
context "with 2 widgets" do | ||
before(:each) do | ||
assign(:widgets, [ | ||
stub_model(Widget, :name => "slicer"), | ||
stub_model(Widget, :name => "dicer") | ||
]) | ||
end | ||
it "displays both widgets" do | ||
render | ||
response.should contain("slicer") | ||
response.should contain("dicer") | ||
end | ||
end | ||
end | ||
""" | ||
When I run "rspec spec/views" | ||
Then I should see "1 example, 0 failures" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters