require "spec_helper.rb" require "generator_spec/test_case" require "generators/rails_blog_engine/install/install_generator" describe RailsBlogEngine::InstallGenerator do include GeneratorSpec::TestCase destination File.expand_path("../../../../tmp", __FILE__) # Create a file with the specified contents in our fake application tree. # This is faster than generating a real application every time we test. def create_file(path, contents) full_path = ::File.join(destination_root, path) mkdir_p(::File.dirname(full_path)) ::File.open(full_path, 'w') {|f| f.write(contents) } end def prepare_destination super create_file('config/routes.rb', < "/blog"' end directory "initializers" do file "rails_blog_engine.rb" end directory "locales" do file "rails_blog_engine.en.yml" end end directory "db" do directory "migrate" do # We don't need to test every single one of these--just make sure # a couple are copied over, and the rest should be OK. file "20110912153527_create_rails_blog_engine_posts.rb" file "20110913190319_add_fields_to_rails_blog_engine_post.rb" end end } end end