Sha256: 7fe6255d62546f4ae19f75e4158f0b159a736a4f6c750b91b3561560367e2851

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

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

include RubyOnAcid

describe LissajousFactory do
  
  
  before :each do
    @it = LissajousFactory.new
  end
  
  describe "general behavior" do
  
    before :each do
      @it.source_factories << mock('Factory', :get_unit => 0.2)
    end
  
    it_should_behave_like "a factory"
    
  end
  
  describe "#get_unit" do
    
    it "Returns x/y coordinates" do
      @it.interval = 0.5
      @it.get_unit(:x).should be_close(0.739, MARGIN)
      @it.get_unit(:y).should be_close(0.990, MARGIN)
      @it.get_unit(:x).should be_close(0.921, MARGIN)
      @it.get_unit(:y).should be_close(0.990, MARGIN)
      @it.get_unit(:x).should be_close(0.998, MARGIN)
      @it.get_unit(:y).should be_close(0.978, MARGIN)
    end
    
    it "returns x for the first assigned key, y for the second, x again for the third, etc." do
      @it.interval = 0.5
      @it.get_unit(:x).should be_close(0.739, MARGIN)
      @it.get_unit(:y).should be_close(0.997, MARGIN)
      @it.get_unit(:z).should be_close(0.739, MARGIN)
      @it.get_unit(:x).should be_close(0.921, MARGIN)
    end
    
  end  

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyonacid-0.4.0 spec/factories/lissajous_spec.rb