forked from indirect/rails3-generators
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds mustache controller generator test
- Loading branch information
Showing
1 changed file
with
31 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,31 @@ | ||
require 'test_helper' | ||
|
||
class MustacheGenerator::Generators::ControllerGeneratorTest < Rails::Generators::TestCase | ||
destination File.join(Rails.root) | ||
tests Rails::Generators::ControllerGenerator | ||
arguments %w(Account foo bar --template-engine mustache_generator) | ||
|
||
setup :prepare_destination | ||
setup :copy_routes | ||
|
||
test "should generate mustache views" do | ||
run_generator | ||
assert_file "app/views/account/foo.rb" | ||
assert_file "app/views/account/bar.rb" | ||
end | ||
|
||
test "should generate mustache views as classes with distinguishing names extending Mustache::Rails" do | ||
run_generator | ||
assert_file "app/views/account/foo.rb", | ||
%r(class FooView < Mustache::Rails) | ||
assert_file "app/views/account/bar.rb", | ||
%r(class BarView < Mustache::Rails) | ||
end | ||
|
||
test "should generate mustache template files" do | ||
run_generator | ||
assert_file "app/templates/account/foo.html.mustache" | ||
assert_file "app/templates/account/bar.html.mustache" | ||
end | ||
|
||
end |