Sha256: b8fc214f72c3ea206524903477c9526b771940da56a800bdce0f2a232e760436

Contents?: true

Size: 894 Bytes

Versions: 1

Compression:

Stored size: 894 Bytes

Contents

require 'spec_helper' 
require 'generator-spec'

describe 'Permits generator' do
  GeneratorSpec.with_generator do
    tests PermitsGenerator
  end

  describe 'result of running generator with default profile' do
    before :each do
      GeneratorSpec.with_generator do |g, check|    
        g.run_generator
      end
    end

    it "should create Admin permit" do
      g.should have_permit :admin
    end
  end

  describe 'result of running generator with option to create permit for each registered role' do
    context "Registered roles :guest, :admin"
      before :each do
        GeneratorSpec.with_generator do |g, check|    
          g.run_generator "--roles admin guest"
        end
      end

      it "should have created Guest and Admin permits" do
        # Find at: 'app/permits/admin_permit.rb'
        g.should have_permits :guest, :admin
      end
    end
  end    
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cancan-permits-0.1.0 spec/generators/permit_generator_spec.rb