From 927d8b8cde930244a16215c57896c8e45f616d0f Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 20 Sep 2009 12:59:32 -0400 Subject: Fix almost all Ruby warnings during spec suite --- spec/arel/algebra/unit/predicates/equality_spec.rb | 2 +- spec/arel/algebra/unit/primitives/attribute_spec.rb | 6 ++---- spec/arel/algebra/unit/relations/alias_spec.rb | 2 +- spec/arel/algebra/unit/relations/relation_spec.rb | 6 +++--- spec/arel/algebra/unit/relations/table_spec.rb | 2 +- spec/arel/engines/sql/unit/predicates/binary_spec.rb | 11 ++++++----- 6 files changed, 14 insertions(+), 15 deletions(-) (limited to 'spec/arel') diff --git a/spec/arel/algebra/unit/predicates/equality_spec.rb b/spec/arel/algebra/unit/predicates/equality_spec.rb index c917520158..01917842f6 100644 --- a/spec/arel/algebra/unit/predicates/equality_spec.rb +++ b/spec/arel/algebra/unit/predicates/equality_spec.rb @@ -11,7 +11,7 @@ module Arel describe '==' do it "obtains if attribute1 and attribute2 are identical" do - Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute1, @attribute2) + check Equality.new(@attribute1, @attribute2).should == Equality.new(@attribute1, @attribute2) Equality.new(@attribute1, @attribute2).should_not == Equality.new(@attribute1, @attribute1) end diff --git a/spec/arel/algebra/unit/primitives/attribute_spec.rb b/spec/arel/algebra/unit/primitives/attribute_spec.rb index cd484007e1..93b661c6fc 100644 --- a/spec/arel/algebra/unit/primitives/attribute_spec.rb +++ b/spec/arel/algebra/unit/primitives/attribute_spec.rb @@ -73,10 +73,8 @@ module Arel describe 'when dividing two matching attributes' do it 'returns a the highest score for the most similar attributes' do - (@aliased_relation[:id] / @relation[:id]) \ - .should == (@aliased_relation[:id] / @relation[:id]) - (@aliased_relation[:id] / @relation[:id]) \ - .should < (@aliased_relation[:id] / @aliased_relation[:id]) + check((@aliased_relation[:id] / @relation[:id]).should == (@aliased_relation[:id] / @relation[:id])) + (@aliased_relation[:id] / @relation[:id]).should < (@aliased_relation[:id] / @aliased_relation[:id]) end end end diff --git a/spec/arel/algebra/unit/relations/alias_spec.rb b/spec/arel/algebra/unit/relations/alias_spec.rb index 2aa4d52d99..eaf31652b9 100644 --- a/spec/arel/algebra/unit/relations/alias_spec.rb +++ b/spec/arel/algebra/unit/relations/alias_spec.rb @@ -8,7 +8,7 @@ module Arel describe '==' do it "obtains if the objects are the same" do - Alias.new(@relation).should_not == Alias.new(@relation) + check Alias.new(@relation).should_not == Alias.new(@relation) (aliaz = Alias.new(@relation)).should == aliaz end end diff --git a/spec/arel/algebra/unit/relations/relation_spec.rb b/spec/arel/algebra/unit/relations/relation_spec.rb index 0a08deffb8..2688ece4a5 100644 --- a/spec/arel/algebra/unit/relations/relation_spec.rb +++ b/spec/arel/algebra/unit/relations/relation_spec.rb @@ -17,8 +17,8 @@ module Arel describe 'when given a', Symbol, String do it "returns the attribute with the same name, if it exists" do - @relation[:id].should == @attribute1 - @relation['id'].should == @attribute1 + check @relation[:id].should == @attribute1 + check @relation['id'].should == @attribute1 @relation[:does_not_exist].should be_nil end end @@ -180,7 +180,7 @@ module Arel describe Relation::Enumerable do it "implements enumerable" do - @relation.collect.should == @relation.session.read(@relation).collect + check @relation.collect.should == @relation.session.read(@relation).collect @relation.first.should == @relation.session.read(@relation).first end end diff --git a/spec/arel/algebra/unit/relations/table_spec.rb b/spec/arel/algebra/unit/relations/table_spec.rb index e4c4e58b75..19c1ba2bea 100644 --- a/spec/arel/algebra/unit/relations/table_spec.rb +++ b/spec/arel/algebra/unit/relations/table_spec.rb @@ -9,7 +9,7 @@ module Arel describe '[]' do describe 'when given a', Symbol do it "manufactures an attribute if the symbol names an attribute within the relation" do - @relation[:id].should == Attribute.new(@relation, :id) + check @relation[:id].should == Attribute.new(@relation, :id) @relation[:does_not_exist].should be_nil end end diff --git a/spec/arel/engines/sql/unit/predicates/binary_spec.rb b/spec/arel/engines/sql/unit/predicates/binary_spec.rb index ccf9d4ef73..783e6c6a7b 100644 --- a/spec/arel/engines/sql/unit/predicates/binary_spec.rb +++ b/spec/arel/engines/sql/unit/predicates/binary_spec.rb @@ -2,15 +2,16 @@ require 'spec_helper' module Arel describe Binary do + class ConcreteBinary < Binary + def predicate_sql + "<=>" + end + end + before do @relation = Table.new(:users) @attribute1 = @relation[:id] @attribute2 = @relation[:name] - class ConcreteBinary < Binary - def predicate_sql - "<=>" - end - end end describe "with compound predicates" do -- cgit v1.2.3