Sha256: 9cc2e2fe43f91fa4f84979bc7e660ba1e71fec64e3065fc791aebeb1ad0b2452

Contents?: true

Size: 1.11 KB

Versions: 7

Compression:

Stored size: 1.11 KB

Contents

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

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

describe 'helper_generator' do  
  before :each do              
    setup_generator 'controller_generator' do
      tests ControllerGenerator
    end    
    remove_controller 'account'    
  end

  after :each do              
    remove_controller 'account'    
  end
    
  it "should not work without an Account controller file" do            
    with_generator do |g|   
      name = 'account'
      g.run_generator [name]
      g.should_not generate_controller name
    end
  end

  it "should decorate an existing Account controller file with a 'control_me' method" do            
    with_generator do |g|  
      name = 'account'
      create_controller name do
        '# controller content'
      end    
      g.run_generator [name]
      g.should generate_controller name do |content|
        content.should have_controller_class name do |klass|
          klass.should have_method :control_me
        end
      end
    end
  end
end



Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
generator-spec-0.4.7 spec/generator_spec/generators/controller_generator_spec.rb
generator-spec-0.4.5 spec/generator_spec/controller_generator_spec.rb
generator-spec-0.4.4 spec/generator_spec/controller_generator_spec.rb
generator-spec-0.4.3 spec/rspec_for_generators/controller_generator_spec.rb
generator-spec-0.4.2 spec/rspec_for_generators/controller_generator_spec.rb
generator-spec-0.4.1 spec/rspec_for_generators/controller_generator_spec.rb
generator-spec-0.4.0 spec/rspec_for_generators/controller_generator_spec.rb