Skip to content

Commit

Permalink
Switch from rr to RSpec mocks. rr has issues on 1.9.2pre
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Nov 10, 2009
1 parent 976999c commit 130188e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions spec/arel/algebra/unit/relations/relation_spec.rb
Expand Up @@ -150,7 +150,7 @@ module Arel
describe '#delete' do
it 'manufactures a deletion relation' do
Session.start do
mock(Session.new).delete(Deletion.new(@relation))
Session.new.should_receive(:delete).with(Deletion.new(@relation))
@relation.delete
end
end
Expand All @@ -160,7 +160,7 @@ module Arel
it 'manufactures an insertion relation' do
Session.start do
record = { @relation[:name] => 'carl' }
mock(Session.new).create(Insert.new(@relation, record))
Session.new.should_receive(:create).with(Insert.new(@relation, record))
@relation.insert(record)
end
end
Expand All @@ -170,7 +170,7 @@ module Arel
it 'manufactures an update relation' do
Session.start do
assignments = { @relation[:name] => Value.new('bob', @relation) }
mock(Session.new).update(Update.new(@relation, assignments))
Session.new.should_receive(:update).with(Update.new(@relation, assignments))
@relation.update(assignments)
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/arel/algebra/unit/session/session_spec.rb
Expand Up @@ -40,34 +40,34 @@ module Arel

describe '#create' do
it "executes an insertion on the connection" do
mock(@insert).call
@insert.should_receive(:call)
@session.create(@insert)
end
end

describe '#read' do
it "executes an selection on the connection" do
mock(@read).call
@read.should_receive(:call)
@session.read(@read)
end

it "is memoized" do
mock(@read).call.once
@read.should_receive(:call).once
@session.read(@read)
@session.read(@read)
end
end

describe '#update' do
it "executes an update on the connection" do
mock(@update).call
@update.should_receive(:call)
@session.update(@update)
end
end

describe '#delete' do
it "executes a delete on the connection" do
mock(@delete).call
@delete.should_receive(:call)
@session.delete(@delete)
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/arel/engines/sql/unit/relations/table_spec.rb
Expand Up @@ -42,8 +42,8 @@ module Arel

describe '#reset' do
it "reloads columns from the database" do
lambda { stub(@relation.engine).columns { [] } }.should_not change { @relation.attributes }
lambda { @relation.reset }.should change { @relation.attributes }
lambda { @relation.engine.stub!(:columns => []) }.should_not change { @relation.attributes }
lambda { @relation.reset }.should change { @relation.attributes }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Expand Up @@ -48,7 +48,7 @@ def check(*args)
config.include BeLikeMatcher, HashTheSameAsMatcher, DisambiguateAttributesMatcher
config.include AdapterGuards
config.include Check
config.mock_with :rr

config.before do
Arel::Table.engine = Arel::Sql::Engine.new(ActiveRecord::Base)
end
Expand Down

0 comments on commit 130188e

Please sign in to comment.