Sha256: 62d81f30c7a188f3be7e4c00ff08c387f0f655b5b66752d918e3bb21c4c095d2
Contents?: true
Size: 897 Bytes
Versions: 4
Compression:
Stored size: 897 Bytes
Contents
require_relative 'spec_helper' class Customer < Lanes::Model def self.attribute_names [:terms_id] end end Lanes::Access::Roles::Support.read << Customer Lanes::Access::Roles::Administrator.lock Customer, :terms_id class LockedFieldsTest < Lanes::TestCase def setup @user = Lanes::User.new( login: 'test', email: 'bob@test.com', name: 'Bob', password: 'testtest') @purchaser = Lanes::User.new( login: 'test', email: 'bob@test.com', name: 'Bob', password: 'testtest') end def test_validations @user.role_names = ['support'] assert_saves @user assert @user.can_read?(Customer), "User with support role cannot read Customer" refute @user.can_write?(Customer), "User can write, but shouldn't be able to" refute @user.can_read?(Customer, :terms_id), "User can read :terms_id but shouldn't be able to" end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
lanes-0.0.5 | spec/locked_fields_spec.rb |
lanes-0.0.3 | spec/locked_fields_spec.rb |
lanes-0.0.2 | spec/locked_fields_spec.rb |
lanes-0.0.1 | spec/locked_fields_spec.rb |