Sha256: 86812f22a9491e6330be5a785e960ef148e5cfc53327d789ef38f70968443dce

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 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

2 entries across 2 versions & 1 rubygems

Version Path
generator-spec-0.5.0 spec/generator_spec/generators/controller_generator_spec.rb
generator-spec-0.4.8 spec/generator_spec/generators/controller_generator_spec.rb