From a46922e4a1089c9880c30b389e1e1d9dfbab02ae Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Fri, 2 Apr 2010 19:04:23 -0700 Subject: Create an Arel::Header class representing a relation's attributes --- spec/support/matchers/be_like.rb | 6 +++--- spec/support/model.rb | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'spec/support') diff --git a/spec/support/matchers/be_like.rb b/spec/support/matchers/be_like.rb index 0608abbbb4..ca49b91274 100644 --- a/spec/support/matchers/be_like.rb +++ b/spec/support/matchers/be_like.rb @@ -1,12 +1,12 @@ module Matchers class BeLike def initialize(expected) - @expected = expected + @expected = expected.gsub(/\s+/, ' ').strip end def matches?(actual) - @actual = actual - @expected.gsub(/\s+/, ' ').strip == @actual.gsub(/\s+/, ' ').strip + @actual = actual.gsub(/\s+/, ' ').strip + @expected == @actual end def failure_message diff --git a/spec/support/model.rb b/spec/support/model.rb index 10a14d7092..be692e53ec 100644 --- a/spec/support/model.rb +++ b/spec/support/model.rb @@ -25,7 +25,7 @@ module Arel class Model include Relation - attr_reader :engine, :attributes + attr_reader :engine def self.build relation = new @@ -46,6 +46,10 @@ module Arel @attributes << type.new(self, name) end + def attributes + Header.new(@attributes) + end + def format(attribute, value) value end -- cgit v1.2.3