forked from amatsuda/active_decorator
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests for controller variable decoration
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 deletions.
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,4 @@ | ||
<% @authors.each do |author| %> | ||
<%= author.name %> | ||
<%= author.reverse_name %> | ||
<% end %> |
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,2 @@ | ||
<%= @author.name %> | ||
<%= @author.capitalized_name %> |
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
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,29 @@ | ||
require 'spec_helper' | ||
|
||
feature 'decorating controller ivar' do | ||
background do | ||
@matz = Author.create! :name => 'matz' | ||
Author.create! :name => 'takahashim' | ||
end | ||
after do | ||
Author.delete_all | ||
end | ||
|
||
scenario 'decorating a model object in ivar' do | ||
visit "/authors/#{@matz.id}" | ||
page.should have_content 'matz' | ||
page.should have_content 'matz'.capitalize | ||
end | ||
|
||
scenario 'decorating model scope in ivar' do | ||
visit '/authors' | ||
page.should have_content 'takahashim' | ||
page.should have_content 'takahashim'.reverse | ||
end | ||
|
||
scenario "decorating models' array in ivar" do | ||
visit '/authors?variable_type=array' | ||
page.should have_content 'takahashim' | ||
page.should have_content 'takahashim'.reverse | ||
end | ||
end |