From 234c3b369a788aec6f008cd5bf00eaeb61e7a00e Mon Sep 17 00:00:00 2001 From: Lourens Naude Date: Sat, 14 Feb 2009 04:34:23 +0000 Subject: [PATCH] Regressions --- lib/scrooge/framework/base.rb | 4 ++-- spec/units/scrooge/framework/base_spec.rb | 8 +++++--- spec/units/scrooge/tracker/model_spec.rb | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/scrooge/framework/base.rb b/lib/scrooge/framework/base.rb index 67c6da0..19e5a42 100644 --- a/lib/scrooge/framework/base.rb +++ b/lib/scrooge/framework/base.rb @@ -208,7 +208,7 @@ def scopes? # Return the scopes storage path for the current framework. # def scopes_path - @profiles_path ||= File.join( config, 'scrooge', 'scopes' ) + @scopes_path ||= File.join( config, 'scrooge', 'scopes' ) end # Return the scopes storage path for a given scope and optional filename. @@ -258,7 +258,7 @@ def to_scope! GUARD.synchronize do scope = Time.now.to_i dump_scope!( scope ) - scope + scope.to_s end end diff --git a/spec/units/scrooge/framework/base_spec.rb b/spec/units/scrooge/framework/base_spec.rb index 2493272..e621dcc 100644 --- a/spec/units/scrooge/framework/base_spec.rb +++ b/spec/units/scrooge/framework/base_spec.rb @@ -77,6 +77,7 @@ @signature = Time.now.to_i.to_s FileUtils.mkdir_p( File.join( @base.scopes_path, @signature ) ) @base.scopes.should include( @signature ) + FileUtils.rm_r( File.join( @base.scopes_path, @signature ) ) end end @@ -84,7 +85,7 @@ with_rails do @base.stub!(:config).and_return( CONFIG ) @base.send( :ensure_scopes_path ) - @base.scopes?().should eql( true ) + @base.scopes?().should eql( false ) end end @@ -106,7 +107,8 @@ with_rails do @base.stub!(:config).and_return( CONFIG ) ::Rails.stub!(:env).and_return( "test" ) - lambda{ @base.to_scope! }.should change( @base.scopes, :size ) + @base.to_scope!() + @base.scopes.size.should == 1 end end @@ -115,7 +117,7 @@ @base.stub!(:config).and_return( CONFIG ) ::Rails.stub!(:env).and_return( "test" ) @scope = @base.to_scope! - lambda{ @base.from_scope!( @scope ) }.should change( Scrooge::Base.profile.tracker, :object_id ) + lambda{ Scrooge::Base.profile.scope = @base.from_scope!( @scope ) }.should change( Scrooge::Base.profile.tracker, :object_id ) end end diff --git a/spec/units/scrooge/tracker/model_spec.rb b/spec/units/scrooge/tracker/model_spec.rb index 4b8dcf9..9e13292 100644 --- a/spec/units/scrooge/tracker/model_spec.rb +++ b/spec/units/scrooge/tracker/model_spec.rb @@ -30,7 +30,8 @@ it "should be able to restore itself from a serialized representation" do @model << [:name, :description, :price] - lambda{ @model.marshal_load( { "Product" => [:price] } ) }.should change( @model.attributes, :size ).from(3).to(1) + @model.marshal_load( { "Product" => [:price] } ) + @model.attributes.size.should eql( 1 ) end it "should be able to render a attribute selection SQL snippet from it's referenced attributes" do @@ -50,11 +51,11 @@ end it "should be able to merge itself with another model tracker" do - @other_model << [:name, :description] + @other_model << %w(name description) @model.merge( @other_model ) - @model.attributes.to_a.should eql( [:name, :description] ) + @model.attributes.to_a.sort.should eql( %w(description name) ) @another_model.merge( @model ) - @another_model.attributes.to_a.should eql( [:name, :description] ) + @another_model.attributes.to_a.sort.should eql( %w(description name) ) @another_model.attributes.should_not_receive(:merge) @another_model.merge( nil ) end