Sha256: 4c2c295b3e2253ce58b9d68bb554a0e5936b823f2eea87b7c132c94b1c6a513f

Contents?: true

Size: 954 Bytes

Versions: 7

Compression:

Stored size: 954 Bytes

Contents

require 'spec_helper'

describe 'SimpleRoles Macros' do

  context "Macros availability" do
    subject { Module }
    before { require 'simple_roles' }
    specify { should be_kind_of SimpleRoles::Macros }
  end

  context "When Macros is applied" do
    subject { User }

    specify { should be_kind_of SimpleRoles::Macros }

    before do
      class User < ActiveRecord::Base
        simple_roles do
          strategy :many
        end
      end
    end

    context "Changes in User" do
      specify { should include SimpleRoles::Many::RolesMethods }
      specify { should include SimpleRoles::Many::RolesMethods }

      [:roles, :roles_list, :add_role, :roles=, :remove_role].each do |meth|
        specify { subject.new.should respond_to meth }
      end
    end

    context "Changes in SimpleRoles::Configuration" do
      it "should set strategy" do
        SimpleRoles::Configuration.strategy.should == :many
      end
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simple_roles-0.0.12 spec/simple_roles/macros_spec.rb
simple_roles-0.0.11 spec/simple_roles/macros_spec.rb
simple_roles-0.0.10 spec/simple_roles/macros_spec.rb
simple_roles-0.0.9 spec/simple_roles/macros_spec.rb
simple_roles-0.0.8 spec/simple_roles/macros_spec.rb
simple_roles-0.0.7 spec/simple_roles/macros_spec.rb
simple_roles-0.0.6 spec/simple_roles/macros_spec.rb