[rspec-users] Experimenting with converting Rails::Generators::TestCase to RSpec 2

Kristian Mandrup kmandrup.github at gmail.com
Thu Jul 8 17:10:20 EDT 2010


http://github.com/kristianmandrup/canable/tree/master/spec/

Example:

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe 'Generator' do
  let(:generator) { Rails::Generators::Testcase.new }

  with generator do
    destination File.join(Rails.root)
    tests Canable::Generators::ModelGenerator
    setup :prepare_destination
    setup :copy_routes
  end

  it "should work"
    generator.run_generator
    generator.should generate_file('app/models/hello.rb')
  end
end

What do you think?


More information about the rspec-users mailing list