Skip to content

Commit

Permalink
testing haml and sass generation for Rails 3 nifty:layout using Cucumber
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanb committed Apr 19, 2010
1 parent 90fdcb3 commit 19807f9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion features/nifty_layout.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,13 @@ Feature: Nifty Layout Generator
Scenario: Generate normal application layout
Given a new Rails app
When I run "rails g nifty:layout"
Then I should see file "app/views/layouts/application.html.erb"
Then I should see "stylesheet_link_tag 'application'" in file "app/views/layouts/application.html.erb"
And I should see file "app/helpers/layout_helper.rb"
And I should see file "public/stylesheets/application.css"

Scenario: Generate named layout with haml and sass
Given a new Rails app
When I run "rails g nifty:layout FooBar --haml"
Then I should see "stylesheet_link_tag 'foo_bar'" in file "app/views/layouts/foo_bar.html.haml"
And I should see file "public/stylesheets/sass/foo_bar.sass"
And I should see file "app/helpers/layout_helper.rb"
6 changes: 6 additions & 0 deletions features/step_definitions/common_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
Then /^I should see file "([^\"]*)"$/ do |path|
File.should exist(File.join(@current_directory, path))
end

Then /^I should see "([^\"]*)" in file "([^\"]*)"$/ do |contents, short_path|
path = File.join(@current_directory, short_path)
File.should exist(path)
File.readlines(path).join.should include(contents)
end

0 comments on commit 19807f9

Please sign in to comment.