From 976999cb980eb47ac5f297de043e2ed55248c2a5 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 9 Nov 2009 19:24:40 -0500 Subject: Ruby 1.9: the constants must be qualified --- spec/arel/algebra/unit/predicates/binary_spec.rb | 2 +- spec/arel/algebra/unit/predicates/equality_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'spec/arel/algebra') diff --git a/spec/arel/algebra/unit/predicates/binary_spec.rb b/spec/arel/algebra/unit/predicates/binary_spec.rb index be4c1ac738..051aeeeb6e 100644 --- a/spec/arel/algebra/unit/predicates/binary_spec.rb +++ b/spec/arel/algebra/unit/predicates/binary_spec.rb @@ -4,7 +4,7 @@ module Arel module Predicates describe Binary do before do - @relation = Table.new(:users) + @relation = Arel::Table.new(:users) @attribute1 = @relation[:id] @attribute2 = @relation[:name] class ConcreteBinary < Binary diff --git a/spec/arel/algebra/unit/predicates/equality_spec.rb b/spec/arel/algebra/unit/predicates/equality_spec.rb index cfd04cd90c..7d1d79ff35 100644 --- a/spec/arel/algebra/unit/predicates/equality_spec.rb +++ b/spec/arel/algebra/unit/predicates/equality_spec.rb @@ -4,8 +4,8 @@ module Arel module Predicates describe Equality do before do - @relation1 = Table.new(:users) - @relation2 = Table.new(:photos) + @relation1 = Arel::Table.new(:users) + @relation2 = Arel::Table.new(:photos) @attribute1 = @relation1[:id] @attribute2 = @relation2[:user_id] end -- cgit v1.2.3 From 130188e67ce76e4ced60dc0331d2ac5bba6cdb74 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 9 Nov 2009 19:31:53 -0500 Subject: Switch from rr to RSpec mocks. rr has issues on 1.9.2pre --- spec/arel/algebra/unit/relations/relation_spec.rb | 6 +++--- spec/arel/algebra/unit/session/session_spec.rb | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'spec/arel/algebra') diff --git a/spec/arel/algebra/unit/relations/relation_spec.rb b/spec/arel/algebra/unit/relations/relation_spec.rb index 35ce8bf1fb..6bd7970e3f 100644 --- a/spec/arel/algebra/unit/relations/relation_spec.rb +++ b/spec/arel/algebra/unit/relations/relation_spec.rb @@ -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 @@ -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 @@ -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 diff --git a/spec/arel/algebra/unit/session/session_spec.rb b/spec/arel/algebra/unit/session/session_spec.rb index 03aab6a03f..0553a140ec 100644 --- a/spec/arel/algebra/unit/session/session_spec.rb +++ b/spec/arel/algebra/unit/session/session_spec.rb @@ -40,19 +40,19 @@ 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 @@ -60,14 +60,14 @@ module Arel 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 -- cgit v1.2.3 From 2eea340b2269aab85cead2a5e024d6ff9abd6c91 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Mon, 9 Nov 2009 19:37:00 -0500 Subject: Ruby 1.9: Improve the way we spec this --- spec/arel/algebra/unit/relations/relation_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/arel/algebra') diff --git a/spec/arel/algebra/unit/relations/relation_spec.rb b/spec/arel/algebra/unit/relations/relation_spec.rb index 6bd7970e3f..cf6509fe6a 100644 --- a/spec/arel/algebra/unit/relations/relation_spec.rb +++ b/spec/arel/algebra/unit/relations/relation_spec.rb @@ -180,8 +180,8 @@ module Arel describe Relation::Enumerable do it "implements enumerable" do - check @relation.collect.should == @relation.session.read(@relation).collect - @relation.first.should == @relation.session.read(@relation).first + @relation.map { |value| value }.should == + @relation.session.read(@relation).map { |value| value } end end end -- cgit v1.2.3