http://github.com/kristianmandrup/canable

In my fork of jnunemaker's canable I show my port of the unit test way
of testing generators for RSpec 2.
It still needs some tidying up to make it even more elegant ;)
Feel free to provide suggestions etc.

Kristian

RSpec 2 example
---
describe 'Generator' do

  before :each do
    remove_model_file 'account'
  end

  GeneratorSpec.with_generator 'Generator' do |g, c, gc|
    gc.tests Canable::Generators::ModelGenerator
  end

  it "should not work without a User mode file" do
    GeneratorSpec.with_generator do |g|
      g.run_generator %w{account}
      g.should_not generate_file('app/models/account.rb')
    end
  end

  it "should not work without a User mode file" do
    GeneratorSpec.with_generator do |g|
      create_model_file 'account'
      g.run_generator %w{account}
      g.should generate_file('app/models/account.rb')
    end
  end
end
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to