Sha256: 1f6d4200df28bf8012a69d608ed7b1f4aa69a50f3a3044dbc7ff189f14783459

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

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

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|   
      name = 'account'
      g.run_generator [name]
      g.should_not generate_helper name
    end
  end

  it "should decorate an existing Account helper file with a 'help_me' method" do
    with_generator do |g|  
      name = 'account'
      create_helper name do
        '# helper content'
      end    
      g.run_generator [name]
      g.should generate_helper name do |content|
        content.should have_helper_class name 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.0 spec/rspec_for_generators/helper_generator_spec.rb