Sha256: 8512d38a95d657a399a0c56fc2fd863a71ab5203d9372fa249c5433f33495571

Contents?: true

Size: 999 Bytes

Versions: 6

Compression:

Stored size: 999 Bytes

Contents

require 'spec_helper'
require_generator :observer

describe 'observer_generator' do 
  use_helper :observer  
     
  before :each do              
    setup_generator 'observer_generator' do
      tests ObserverGenerator
    end    
    remove_observer :account    
  end

  after :each do              
    remove_observer :account    
  end
    
  it "should not work without an Account observer file" do            
    with_generator do |g|   
      g.run_generator :account.args
      g.should_not generate_observer :account
    end
  end

  it "should decorate an existing Account observer file with a 'observe_me' method" do            
    with_generator do |g|  
      create_observer :account do
        '# observer content'
      end    
      g.run_generator :account.args
      g.should generate_observer :account do |content|        
        content.should have_observer_class :account do |klass|
          klass.should have_method :observe_me
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
generator-spec-0.7.1 spec/generator_spec/generators/observer_gen_spec.rb
generator-spec-0.7.0 spec/generator_spec/generators/observer_gen_spec.rb
generator-spec-0.6.6 spec/generator_spec/generators/observer_gen_spec.rb
generator-spec-0.6.5 spec/generator_spec/generators/observer_gen_spec.rb
generator-spec-0.6.4 spec/generator_spec/generators/observer_gen_spec.rb
generator-spec-0.6.3 spec/generator_spec/generators/observer_gen_spec.rb