Sha256: e913355d93e791de91096316e99a39bdc8551b1f378e309d50e6bbe55e22012e

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

require 'generator_spec_helper'
require_generator :cream => :app

LOGFILE = 'cream-app-config.log'

describe 'Generator' do
  use_helpers :controller, :special, :file, :view

  before :each do              
    setup_generator :cream_app_generator do
      tests Cream::Generators::AppGenerator
    end    
  end

  describe "Configure Rails 3 app as a Cream app" do    
    before do    
      Dir.chdir Rails.root do        
        @generator = with_generator do |g|
          arguments = "--orm mongoid --logfile #{LOGFILE}".args
          g.run_generator arguments
        end
      end
    end

    describe 'result of app generator' do       
      it "should replace requirement statements in application file" do      
        ["action_controller/railtie", "action_mailer/railtie", "active_resource/railtie", "rails/test_unit/railtie"].each do |req|
          req = Regexp.escape(req)
          read_application_file.should match /#{req}/
        end
      end

      it "should add notice and alert flash displayers to application layout" do
        [:alert, :notice].each do |name|
          read_view(:layouts, :application).should match /<%= #{name} %>/
        end
      end

      it "should generate MainController" do
        controller_file?(:main).should be_true
      end
      
      it "should add root to routes file" do
        read_routes_file.should match /root\s+:to\s*=>/
      end
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cream-0.9.2 spec/generators/cream/app/app_generator_spec.rb
cream-0.9.1 spec/generators/cream/app/app_generator_spec.rb