Sha256: 00660095c60ed4a80ca73a0fe53dbd001ff12b6282a24ff0e290d0464be7514a

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'generator_spec_helper'
require_generator :permits => :config

LOGFILE = 'permits-config.log'

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

  before :each do              
    setup_generator :permits_config_generator do
      tests Permits::Generators::ConfigGenerator
    end    
  end

  describe "Configure Rails 3 app for use with CanCan Permits" do
    before do    
      puts "Running generator"
      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 permits generator' do

      it "should add the gem :cancan-permits" do
        # TODO
        Rails.root.should have_gem 'cancan-permits'
      end

      it "should generate a permits initializer file with orm set to mongoid" do      
        File.read(initializer_file(:permits)).should match /Permits::Application.orm = mongoid/
      end      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cream-0.7.0 spec/generators/permits/config/permits_config_generator_spec.rb