Skip to content

Commit

Permalink
Adds mustache controller generator test
Browse files Browse the repository at this point in the history
  • Loading branch information
goodmike authored and phaza committed Jul 6, 2010
1 parent f7045d1 commit dc7a78b
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/lib/generators/mustache/controller_generator_test.rb
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

0 comments on commit dc7a78b

Please sign in to comment.