Sha256: 1f5c4e01209c0ec4d9efb781e28cabfde548968942c352c73f623c4cd2862bb0

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "Karousel" do
  before(:all) do
    @karousel = Karousel.new(ClientJobDummy, 20, 0)
  end

  before(:each) do
    ClientJobDummy.reset
  end
  
  it "should initiate" do
    k = Karousel.new(ClientJobDummy, 20, 0)
    k.class.should == Karousel
  end

  it "should have size" do
    @karousel.size.should == 20
    @karousel.seats.size.should == 0
    @karousel.time_interval.should == 0
  end
  
  it "should run with block" do
    karousel = Karousel.new(ClientJobDummy, 20, 0)
    karousel.run do
      karousel.cycle_data.size.should > 0
      statuses = karousel.cycle_data.map {|c| c.status}
      statuses.uniq!
      [:failure, :success].should == statuses.sort! if statuses.size > 1
    end
  end

  it "should be able to get loaded with jobs" do 
    @karousel.seats.size.should == 0 
    @karousel.populate
    @karousel.seats.size.should == 20
    @karousel.seats[0].class == Karousel::Job
    @karousel.seats[0].status.should == :init
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
karousel-0.9.12 spec/karousel_spec.rb
karousel-0.9.11 spec/karousel_spec.rb
karousel-0.9.10 spec/karousel_spec.rb
karousel-0.9.9 spec/karousel_spec.rb
karousel-0.9.8 spec/karousel_spec.rb