Sha256: cf7d7d355fd86aab02bf5858d6fbefe680db3bd510cafcef7cd936c72b491939

Contents?: true

Size: 639 Bytes

Versions: 10

Compression:

Stored size: 639 Bytes

Contents

require 'spec_helper'

describe SecuredModel do

  it "can find models by Class and role" do
    admin_role = Role.create(:description => 'Admin', :internal_identifier => 'admin')
    admin_user = User.create(:username => "admin",:email => "admin@portablemind.com")
    admin_user.add_role('admin')

    admin_user.has_role?('admin').should eq true

    model = SecuredModel.find_models_by_klass_and_role(User, 'admin').first
    model.username.should eq 'admin'

    model = SecuredModel.find_models_by_klass_and_role('User', admin_role).first
    model.username.should eq 'admin'

    admin_user.destroy
    admin_role.destroy
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
erp_tech_svcs-3.0.10 spec/models/secured_model_spec.rb
erp_tech_svcs-3.0.9 spec/models/secured_model_spec.rb
erp_tech_svcs-3.0.8 spec/models/secured_model_spec.rb
erp_tech_svcs-3.0.7 spec/models/secured_model_spec.rb
erp_tech_svcs-3.0.6 spec/models/secured_model_spec.rb
erp_tech_svcs-3.0.5 spec/models/secured_model_spec.rb
erp_tech_svcs-3.0.4 spec/models/secured_model_spec.rb
erp_tech_svcs-3.0.3 spec/models/secured_model_spec.rb
erp_tech_svcs-3.0.2 spec/models/secured_model_spec.rb
erp_tech_svcs-3.0.1 spec/models/secured_model_spec.rb