Sha256: db283de8118c4adb0b02aec428639782d811ba43f9493847b9a8b067ddad7c52

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

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

RSpec::Generator.configure do |config|
  config.debug = true
end

require_generators :all

module RSpec::Core
  class ExampleGroup
    include RSpec::Rails::Helper
  end
end

describe 'helper_generator' do  
  before :each do              
    setup_generator 'helper_generator' do
      tests HelperGenerator
    end    
    remove_helper :account    
  end

  after :each do              
    remove_helper :account    
  end
    
  it "should not work without an Account helper file" do            
    with_generator do |g|
      g.run_generator :account.args
      g.should_not generate_helper :account
    end
  end

  it "should decorate an existing Account helper file with a 'help_me' method" do
    with_generator do |g|  
      create_helper :account do
        '# helper content'
      end    
      g.run_generator [:account].args
      g.should generate_helper :account do |content|
        content.should have_helper_class :account do |klass|
          klass.should have_method :help_me
        end
      end
    end
  end
end



Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
generator-spec-0.4.4 spec/generator_spec/helper_generator_spec.rb