Sha256: 77c2a599c3ac1e78b80f698dc30a725f983a35e8a20d025ad46c0dd114f1dac2

Contents?: true

Size: 867 Bytes

Versions: 27

Compression:

Stored size: 867 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))

describe Castronaut::Models::Consumeable do
  
  class FakeModel
    include Castronaut::Models::Consumeable

    attr_accessor :consumed_at, :id
    
    def save!
      
    end
  end
  
  describe "consume!" do
  
    it "sets consumed to the current time" do
      fake_model = stub_model(FakeModel).as_new_record
      fake_model.should_receive(:consumed_at=)
      fake_model.consume!
    end
    
    it "calls save!" do
      fake_model = stub_model(FakeModel).as_new_record
      fake_model.should_receive(:save!)
      fake_model.consume!
    end
  
  end
  
  it "is consumed when consumed_at has a value" do
    fake_model = FakeModel.new
    fake_model.should_not be_consumed
    
    fake_model.consumed_at = Time.now
    fake_model.should be_consumed
  end
  
end

Version data entries

27 entries across 27 versions & 6 rubygems

Version Path
3mix-castronaut-0.5.0.2 spec/castronaut/models/consumeable_spec.rb
masover-castronaut-0.4.4.4 spec/castronaut/models/consumeable_spec.rb
masover-castronaut-0.4.4.5 spec/castronaut/models/consumeable_spec.rb
masover-castronaut-0.5.0.1 spec/castronaut/models/consumeable_spec.rb
p8-castronaut-0.6.1.1 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.2.0 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.2.5 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.3.0 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.3.5 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.3.6 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.4.1 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.4.2 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.4.3 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.4.4 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.4.5 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.4.6 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.5.0 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.5.1 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.5.2 spec/castronaut/models/consumeable_spec.rb
relevance-castronaut-0.5.3 spec/castronaut/models/consumeable_spec.rb