Sha256: c83a32603b4c0476d3cf2052d396199f044b2edac4e2005f8fabb845713de7a8
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
require File.join(File.dirname(__FILE__), 'spec_helper') describe Permissive::Permissions do before :each do PermissiveSpecHelper.db_up end after :each do PermissiveSpecHelper.db_down end context "permission constants" do it "should have a `hash' method" do Permissive::Permissions.should respond_to(:hash) end it "should return an ordered hash when `hash' is called" do Permissive::Permissions.hash.should be_instance_of(ActiveSupport::OrderedHash) end it "should have symbol keys for the permission constants" do Permissive::Permissions.hash.has_key?(:finalize_lab_selection_list).should be_true end it "should convert all CONSTANT values to base-2 compatible integers" do Permissive::Permissions.constants.each do |constant| Permissive::Permissions.hash[constant.downcase.to_sym].should == 2 ** Permissive::Permissions.const_get(constant) end end it "should explode when a constant isn't Numeric" do Permissive::Permissions.const_set('FOOBAR', 'achoo') lambda { Permissive::Permissions.hash }.should raise_error(Permissive::PermissionError) Permissive::Permissions.const_set('FOOBAR', 5) lambda { Permissive::Permissions.hash }.should_not raise_error(Permissive::PermissionError) end end end PermissiveSpecHelper.clear_log
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
permissive-0.0.1 | spec/permissions_spec.rb |
permissive-0.0.0 | spec/permissions_spec.rb |