Sha256: 9e919f0603c874c907b4c7cffe41e021880bdb1756653ce7f2ac7dccc359c3fd

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper' 

RSpec::Generator::Require.root_dir = 'generator_spec/fixtures'

puts "root_dir: #{RSpec::Generator::Require.root_dir}"

RSpec::Generator.debug = true

require_generator :controller

describe 'helper_generator' do  
  use_helpers :controller #, :special  
  
  before do
    create_rails_app
  end
  
  after do
    remove_rails_app
  end
  
  before :each do              
    setup_generator :controller do
      tests ControllerGenerator
    end    
    remove_controller :account    
  end
  
  after :each do              
    remove_controller :account    
  end

  it "should have created temporary Rails app with a Gemfile" do
    # read_gem_file.should_not be_empty
  end          
    
  it "should not work without an Account controller file" do
    with_generator do |g|   
      g.run_generator :account.args
      g.should_not generate_controller :account
    end
  end
  
  it "should decorate an existing Account controller file with a 'control_me' method" do            
    with_generator do |g|  
      create_controller :account do
        '# controller content'
      end    
      g.run_generator :account.args
      g.should generate_controller :account do |content|
        content.should have_method :control_me
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
generator-spec-0.7.8 spec/generator_spec/generators/controller_gen_spec.rb
generator-spec-0.7.6 spec/generator_spec/generators/controller_gen_spec.rb
generator-spec-0.7.5 spec/generator_spec/generators/controller_gen_spec.rb