diff --git a/lib/redistat/key.rb b/lib/redistat/key.rb index 5d89572..4246e29 100644 --- a/lib/redistat/key.rb +++ b/lib/redistat/key.rb @@ -30,13 +30,14 @@ module Redistat options[:depth] end - def scope - @scope.to_s - end + # def scope + # @scope.to_s + # end def scope=(input) @scope = (input.instance_of?(Redistat::Scope)) ? input : Scope.new(input) end + attr_reader :scope def label=(input) @label = (input.instance_of?(Redistat::Label)) ? input : Label.create(input, @options) diff --git a/spec/event_spec.rb b/spec/event_spec.rb index e586894..b7384c0 100644 --- a/spec/event_spec.rb +++ b/spec/event_spec.rb @@ -17,7 +17,7 @@ describe Redistat::Event do it "should initialize properly" do @event.id.should be_nil - @event.scope.should == @scope + @event.scope.to_s.should == @scope @event.label.to_s.should == @label @event.label_hash.should == @label_hash @event.date.to_time.to_s.should == @date.to_s @@ -63,7 +63,7 @@ describe Redistat::Event do it "should find event by id" do @event = Redistat::Event.new(@scope, @label, @date, @stats, @options.merge({:store_event => true}), @meta).save fetched = Redistat::Event.find(@scope, @event.id) - @event.scope.should == fetched.scope + @event.scope.to_s.should == fetched.scope.to_s @event.label.to_s.should == fetched.label.to_s @event.date.to_s.should == fetched.date.to_s end diff --git a/spec/key_spec.rb b/spec/key_spec.rb index 56eb126..eac99c5 100644 --- a/spec/key_spec.rb +++ b/spec/key_spec.rb @@ -13,7 +13,7 @@ describe Redistat::Key do end it "should initialize properly" do - @key.scope.should == @scope + @key.scope.to_s.should == @scope @key.label.to_s.should == @label @key.label_hash.should == @label_hash @key.groups.map { |k| k.instance_variable_get("@label") }.should == @key.instance_variable_get("@label").groups @@ -44,10 +44,10 @@ describe Redistat::Key do it "should allow changing attributes" do # scope - @key.scope.should == @scope + @key.scope.to_s.should == @scope @scope = "VisitorCount" @key.scope = @scope - @key.scope.should == @scope + @key.scope.to_s.should == @scope # date @key.date.to_time.to_s.should == @date.to_s @date = Time.now