Sha256: 33449ccdfac75ba3dac2c367c85282706e87353f105c5c54f1ba49d3ff8e4605

Contents?: true

Size: 724 Bytes

Versions: 27

Compression:

Stored size: 724 Bytes

Contents

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

describe Castronaut::Models::Dispenser do
  module Foo
    module Bar
      
      class FakeModel
        include Castronaut::Models::Dispenser
    
        attr_accessor :ticket
    
        def ticket_prefix
          "WOO!"
        end
    
        def write_attribute(attr, value)
          instance_variable_set "@#{attr}", value
        end
      end
      
    end
  end
  
  it "generates the ticket using the classes ticket prefix and a random string" do
    Castronaut::Utilities::RandomString.stub!(:generate).and_return("RANDOM")
    
    Foo::Bar::FakeModel.new.send(:dispense_ticket).should == "WOO!-RANDOM"
  end
  
end

Version data entries

27 entries across 27 versions & 6 rubygems

Version Path
relevance-castronaut-0.5.4 spec/castronaut/models/dispenser_spec.rb
relevance-castronaut-0.6.0 spec/castronaut/models/dispenser_spec.rb
relevance-castronaut-0.6.1 spec/castronaut/models/dispenser_spec.rb
relevance-castronaut-0.7.4 spec/castronaut/models/dispenser_spec.rb
relevance-castronaut-0.7.5 spec/castronaut/models/dispenser_spec.rb
nbudin-castronaut-0.7.5 spec/castronaut/models/dispenser_spec.rb
factorylabs-castronaut-0.7.5 spec/castronaut/models/dispenser_spec.rb