Sha256: cde374dde684f59875e134f79056fdb2f1b0f0d922d23fbdadf181c7b65b5c90
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
require File.join(File.dirname(__FILE__), '..', 'spec_helper') require "shared_factory_specs" require 'rubyonacid/factories/increment' include RubyOnAcid describe IncrementFactory do MARGIN = 0.01 before :each do @it = IncrementFactory.new end it_should_behave_like "a factory" it "Stops at 1 if increment is positive" do @it.interval = 0.3 @it.get_unit(:x).should be_close(0.3, MARGIN) @it.get_unit(:x).should be_close(0.6, MARGIN) @it.get_unit(:x).should be_close(0.9, MARGIN) @it.get_unit(:x).should be_close(1.0, MARGIN) @it.get_unit(:x).should be_close(1.0, MARGIN) end it "Stops at 0 if increment is negative" do @it.interval = -0.3 @it.get_unit(:x).should be_close(0.7, MARGIN) @it.get_unit(:x).should be_close(0.4, MARGIN) @it.get_unit(:x).should be_close(0.1, MARGIN) @it.get_unit(:x).should be_close(0.0, MARGIN) @it.get_unit(:x).should be_close(0.0, MARGIN) end it "handles multiple keys" do @it.interval = 0.3 @it.get_unit(:x).should be_close(0.3, MARGIN) @it.get_unit(:y).should be_close(0.3, MARGIN) @it.get_unit(:x).should be_close(0.6, MARGIN) @it.get_unit(:y).should be_close(0.6, MARGIN) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubyonacid-0.1.2 | spec/generators/increment_spec.rb |
rubyonacid-0.1.1 | spec/generators/increment_spec.rb |
rubyonacid-0.1.0 | spec/generators/increment_spec.rb |