[rspec-users] generator-spec release 0.4.8
Kristian Mandrup
kmandrup.github at gmail.com
Sat Aug 14 12:42:09 EDT 2010
Just released 0.5.0, a pretty stable release with a large rspec test
suite to show it off and ensure it works as it should :)
On Aug 11, 6:02 pm, Kristian Mandrup <kmandrup.git... at gmail.com>
wrote:
> Now with an almost complete test suite to ensure it all works as it
> should and to demonstrate how to use it.
> The DSL is better than ever!
>
> describe 'model_generator' do
> # include Rails model helpers for ActiveRecord
> # available:
>
> # Other ORM options - :mongo_mapper, :mongoid and :data_mapper
> # note: use_orm auto-includes the :model helper module
> use_orm :active_record
>
> # load helper modules and make available inside spec blocks
> # here the module in rails_helpers/rails_migration is included
> helpers :migration
>
> before :each do
> # define generator to test
> setup_generator 'model_generator' do
> tests Canable::Generators::ModelGenerator
> end
> # ensure clean state before each run
> remove_model :account
> end
>
> after :each do
> # ensure clean state after each run
> remove_model :account
> end
>
> it "should not work without an existing Account model file"
> do
> with_generator do |g|
> g.run_generator :account.args
> g.should_not generate_file :account, :model
> end
> end
>
> it "should decorate an existing Account model file with 'include
> Canable:Ables'" do
> with_generator do |g|
> create_model :account
> g.run_generator 'account'.args
> g.should generate_model :account do |content|
> content.should have_class :account do |klass|
> klass.should include_module 'Canable::Ables'
> end
> end
> end
> end
> end
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users
More information about the rspec-users
mailing list