Sha256: 0776efae09936dffc116419678d4f4ea5dd43f1c3463c8523664054117dabe2c

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')
require "shared_factory_specs"
require 'rubyonacid/factories/flash'

include RubyOnAcid

describe FlashFactory do
  
  before :each do
    @it = FlashFactory.new
  end
  
  it_should_behave_like "a factory"
  
  it "returns 1.0 three times, then 0.0 three times, then loops" do
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:x).should == 0.0
    @it.get_unit(:x).should == 0.0
    @it.get_unit(:x).should == 0.0
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:x).should == 0.0
    @it.get_unit(:x).should == 0.0
    @it.get_unit(:x).should == 0.0
  end
  
  it "can take a different interval" do
    @it.interval = 2
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:x).should == 0.0
    @it.get_unit(:x).should == 0.0
    @it.get_unit(:x).should == 1.0
  end
  
  it "handles multiple keys" do
    @it.interval = 2
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:y).should == 1.0
    @it.get_unit(:x).should == 1.0
    @it.get_unit(:y).should == 1.0
    @it.get_unit(:x).should == 0.0
    @it.get_unit(:y).should == 0.0
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubyonacid-0.4.0 spec/factories/flash_spec.rb
rubyonacid-0.3.1 spec/factories/flash_spec.rb
rubyonacid-0.3.0 spec/factories/flash_spec.rb
rubyonacid-0.2.0 spec/factories/flash_spec.rb
rubyonacid-0.1.2 spec/generators/flash_spec.rb
rubyonacid-0.1.1 spec/generators/flash_spec.rb
rubyonacid-0.1.0 spec/generators/flash_spec.rb