spec/osm/model_spec.rb in osm-1.2.17 vs spec/osm/model_spec.rb in osm-1.2.18.dev
- old
+ new
@@ -65,34 +65,34 @@
describe "Caching" do
it "Checks for existance" do
OsmTest::Cache.should_receive('exist?').with('OSMAPI-osm-key') { true }
- ModelTester.cache('exist?', @api, 'key').should be_true
+ ModelTester.cache('exist?', @api, 'key').should == true
end
it "Writes" do
OsmTest::Cache.should_receive('write').with('OSMAPI-osm-key', 'data', {:expires_in=>600}) { true }
- ModelTester.cache('write', @api, 'key', 'data').should be_true
+ ModelTester.cache('write', @api, 'key', 'data').should == true
end
it "Reads" do
OsmTest::Cache.should_receive('read').with('OSMAPI-osm-key') { 'data' }
ModelTester.cache('read', @api, 'key').should == 'data'
end
it "Deletes" do
OsmTest::Cache.should_receive('delete').with('OSMAPI-osm-key') { true }
- ModelTester.cache('delete', @api, 'key').should be_true
+ ModelTester.cache('delete', @api, 'key').should == true
end
it "Behaves when cache is nil (no caching)" do
Osm::Model.configure({:cache => nil})
- ModelTester.cache('exist?', @api, 'key').should be_false
- ModelTester.cache('write', @api, 'key', 'data').should be_false
+ ModelTester.cache('exist?', @api, 'key').should == false
+ ModelTester.cache('write', @api, 'key', 'data').should == false
ModelTester.cache('read', @api, 'key').should be_nil
- ModelTester.cache('delete', @api, 'key').should be_true
+ ModelTester.cache('delete', @api, 'key').should == true
end
it "Builds a key from an array" do
ModelTester.cache('key', @api, ['a', 'b']).should == 'OSMAPI-osm-a-b'
end
@@ -146,37 +146,37 @@
(@mt2 <=> @mt1).should == 1
(@mt2 <=> @mt2a).should == 0
end
it ">" do
- (@mt1 > @mt2).should be_false
- (@mt2 > @mt1).should be_true
- (@mt2 > @mt2a).should be_false
+ (@mt1 > @mt2).should == false
+ (@mt2 > @mt1).should == true
+ (@mt2 > @mt2a).should == false
end
it ">=" do
- (@mt1 >= @mt2).should be_false
- (@mt2 >= @mt1).should be_true
- (@mt2 >= @mt2a).should be_true
+ (@mt1 >= @mt2).should == false
+ (@mt2 >= @mt1).should == true
+ (@mt2 >= @mt2a).should == true
end
it "<" do
- (@mt1 < @mt2).should be_true
- (@mt2 < @mt1).should be_false
- (@mt2 < @mt2a).should be_false
+ (@mt1 < @mt2).should == true
+ (@mt2 < @mt1).should == false
+ (@mt2 < @mt2a).should == false
end
it "<=" do
- (@mt1 <= @mt2).should be_true
- (@mt2 <= @mt1).should be_false
- (@mt2 <= @mt2a).should be_true
+ (@mt1 <= @mt2).should == true
+ (@mt2 <= @mt1).should == false
+ (@mt2 <= @mt2a).should == true
end
it "between" do
- @mt2.between?(@mt1, @mt3).should be_true
- @mt1.between?(@mt1, @mt3).should be_false
- @mt3.between?(@mt1, @mt3).should be_false
+ @mt2.between?(@mt1, @mt3).should == true
+ @mt1.between?(@mt1, @mt3).should == false
+ @mt3.between?(@mt1, @mt3).should == false
end
end
describe "Access control" do
@@ -186,19 +186,19 @@
before :each do
@api.stub(:get_user_permissions).and_return( { 1 => {foo: [:bar]} } )
end
it "Has permission" do
- Osm::Model.user_has_permission?(@api, :bar, :foo, 1).should be_true
+ Osm::Model.user_has_permission?(@api, :bar, :foo, 1).should == true
end
it "Doesn't have the level of permission" do
- Osm::Model.user_has_permission?(@api, :barbar, :foo, 1).should be_false
+ Osm::Model.user_has_permission?(@api, :barbar, :foo, 1).should == false
end
it "Doesn't have access to section" do
- Osm::Model.user_has_permission?(@api, :bar, :foo, 2).should be_false
+ Osm::Model.user_has_permission?(@api, :bar, :foo, 2).should == false
end
end
describe "api_has_permission?" do
@@ -210,20 +210,20 @@
permissions: {foo: [:bar]}
))
end
it "Has permission" do
- Osm::Model.api_has_permission?(@api, :bar, :foo, 1).should be_true
+ Osm::Model.api_has_permission?(@api, :bar, :foo, 1).should == true
end
it "Doesn't have the level of permission" do
- Osm::Model.api_has_permission?(@api, :barbar, :foo, 1).should be_false
+ Osm::Model.api_has_permission?(@api, :barbar, :foo, 1).should == false
end
it "Doesn't have access to the section" do
Osm::ApiAccess.stub(:get_ours).and_return(nil)
- Osm::Model.api_has_permission?(@api, :bar, :foo, 2).should be_false
+ Osm::Model.api_has_permission?(@api, :bar, :foo, 2).should == false
end
end
describe "has_permission?" do
@@ -231,19 +231,19 @@
it "Only returns true if the user can and they have granted the api permission" do
section = Osm::Section.new
options = {:foo => :bar}
expect(Osm::Model).to receive('user_has_permission?').with(@api, :can_do, :can_to, section, options).and_return(true)
expect(Osm::Model).to receive('api_has_permission?').with(@api, :can_do, :can_to, section, options).and_return(true)
- Osm::Model.has_permission?(@api, :can_do, :can_to, section, options).should be_true
+ Osm::Model.has_permission?(@api, :can_do, :can_to, section, options).should == true
end
describe "Otherwise returns false" do
[ [true,false], [false, true], [false, false] ].each do |user, api|
it "User #{user ? 'can' : "can't"} and #{api ? 'has' : "hasn't"} given access" do
Osm::Model.stub('user_has_permission?').and_return(user)
Osm::Model.stub('api_has_permission?').and_return(api)
- Osm::Model.has_permission?(@api, :can_do, :can_to, Osm::Section.new).should be_false
+ Osm::Model.has_permission?(@api, :can_do, :can_to, Osm::Section.new).should == false
end
end
end
end
@@ -253,14 +253,14 @@
before :each do
@api.stub(:get_user_permissions).and_return( {1=>{}} )
end
it "Has access" do
- Osm::Model.has_access_to_section?(@api, 1).should be_true
+ Osm::Model.has_access_to_section?(@api, 1).should == true
end
it "Doesn't have access" do
- Osm::Model.has_access_to_section?(@api, 2).should be_false
+ Osm::Model.has_access_to_section?(@api, 2).should == false
end
end
describe "require_access_to_section" do