Sha256: 4fc2480e18af21ea32e4965042193dab38a63c1bd144940e262115ef5ccbebf2
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require File.join(File.dirname(__FILE__), '..', 'spec_helper') require 'rubyonacid/factories/repeat' require "shared_factory_specs" include RubyOnAcid describe RepeatFactory do describe "general behavior" do before :each do @it.source_factories << mock('Factory', :get_unit => 0.2) end it_should_behave_like "a factory" end before :each do @it = RepeatFactory.new end it "Requests a value from the source factory and repeats it a given number of times" do source_factory = mock('Factory') source_factory.should_receive(:get_unit).exactly(3).times.and_return(0.0, 1.0, 0.5) @it.source_factories << source_factory @it.repeat_count = 2 @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 == 0.5 end it "Tracks repeats on a per-key basis" do source_factory = mock('Factory') source_factory.should_receive(:get_unit).exactly(4).times.and_return(0.0, 1.0, 0.5, 0.75) @it.source_factories << source_factory @it.repeat_count = 2 @it.get_unit(:x).should == 0.0 @it.get_unit(:y).should == 1.0 @it.get_unit(:x).should == 0.0 @it.get_unit(:y).should == 1.0 @it.get_unit(:x).should == 0.5 @it.get_unit(:y).should == 0.75 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyonacid-0.4.0 | spec/factories/repeat_spec.rb |