Permalink
Browse files

rr => mocha

  • Loading branch information...
1 parent be14aa4 commit 554e6ab378a3c10a28d9c91a3fa282e2ae616b43 @joshuaclayton joshuaclayton committed Aug 13, 2011
View
@@ -5,7 +5,8 @@ gem "rspec", "~> 2.0"
gem "rcov"
gem "activerecord", :require => false
gem "activesupport", :require => false
-gem "rr"
+gem "mocha"
+gem "bourne"
gem "sqlite3-ruby", :require => false
gem "appraisal", "~> 0.3.5"
gem "yard"
View
@@ -22,6 +22,8 @@ GEM
cucumber (>= 0.10.5)
rspec (>= 2.6.0)
bluecloth (2.0.9)
+ bourne (1.0)
+ mocha (= 0.9.8)
builder (2.1.2)
childprocess (0.1.9)
ffi (~> 1.0.6)
@@ -37,9 +39,10 @@ GEM
json (>= 1.4.6)
i18n (0.4.2)
json (1.5.3)
+ mocha (0.9.8)
+ rake
rake (0.9.2)
rcov (0.9.9)
- rr (1.0.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -61,10 +64,11 @@ DEPENDENCIES
activesupport
appraisal (~> 0.3.5)
bluecloth
+ bourne
cucumber (~> 1.0.0)
+ mocha
rake
rcov
- rr
rspec (~> 2.0)
sqlite3-ruby
yard
View
@@ -22,7 +22,8 @@ Gem::Specification.new do |s|
s.add_development_dependency('cucumber')
s.add_development_dependency('activerecord', '~>2.3.5')
s.add_development_dependency('activerecord', '~>3.0.0.beta3')
- s.add_development_dependency('rr')
+ s.add_development_dependency('mocha')
+ s.add_development_dependency('bourne')
s.add_development_dependency('sqlite3')
s.add_development_dependency('aruba')
View
@@ -2,15 +2,17 @@
source "http://rubygems.org"
-gem "test-unit", "~> 2.3.0", :platforms=>[:mri_19]
-gem "rr"
-gem "activerecord", "~> 2.1"
+gem "cucumber", "~> 1.0.0"
gem "rake"
-gem "sqlite3-ruby", :require=>false
-gem "bluecloth"
gem "rspec", "~> 2.0"
-gem "yard"
gem "rcov"
-gem "cucumber", "~> 1.0.0"
+gem "activerecord", "~> 2.1"
+gem "activesupport", :require=>false
+gem "mocha"
+gem "bourne"
+gem "sqlite3-ruby", :require=>false
gem "appraisal", "~> 0.3.5"
+gem "yard"
+gem "bluecloth"
+gem "test-unit", "~> 2.3.0", :platforms=>[:mri_19]
@@ -13,6 +13,8 @@ GEM
cucumber (>= 0.10.5)
rspec (>= 2.6.0)
bluecloth (2.1.0)
+ bourne (1.0)
+ mocha (= 0.9.8)
builder (3.0.0)
childprocess (0.1.9)
ffi (~> 1.0.6)
@@ -27,9 +29,10 @@ GEM
gherkin (2.4.1)
json (>= 1.4.6)
json (1.5.3)
+ mocha (0.9.8)
+ rake
rake (0.9.2)
rcov (0.9.9)
- rr (1.0.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -50,12 +53,14 @@ PLATFORMS
DEPENDENCIES
activerecord (~> 2.1)
+ activesupport
appraisal (~> 0.3.5)
bluecloth
+ bourne
cucumber (~> 1.0.0)
+ mocha
rake
rcov
- rr
rspec (~> 2.0)
sqlite3-ruby
test-unit (~> 2.3.0)
View
@@ -2,14 +2,16 @@
source "http://rubygems.org"
-gem "rr"
-gem "activerecord", "~> 2.3"
+gem "cucumber", "~> 1.0.0"
gem "rake"
-gem "sqlite3-ruby", :require=>false
-gem "bluecloth"
gem "rspec", "~> 2.0"
-gem "yard"
gem "rcov"
-gem "cucumber", "~> 1.0.0"
+gem "activerecord", "~> 2.3"
+gem "activesupport", :require=>false
+gem "mocha"
+gem "bourne"
+gem "sqlite3-ruby", :require=>false
gem "appraisal", "~> 0.3.5"
+gem "yard"
+gem "bluecloth"
@@ -13,6 +13,8 @@ GEM
cucumber (>= 0.10.5)
rspec (>= 2.6.0)
bluecloth (2.1.0)
+ bourne (1.0)
+ mocha (= 0.9.8)
builder (3.0.0)
childprocess (0.1.9)
ffi (~> 1.0.6)
@@ -27,9 +29,10 @@ GEM
gherkin (2.4.1)
json (>= 1.4.6)
json (1.5.3)
+ mocha (0.9.8)
+ rake
rake (0.9.2)
rcov (0.9.9)
- rr (1.0.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -49,12 +52,14 @@ PLATFORMS
DEPENDENCIES
activerecord (~> 2.3)
+ activesupport
appraisal (~> 0.3.5)
bluecloth
+ bourne
cucumber (~> 1.0.0)
+ mocha
rake
rcov
- rr
rspec (~> 2.0)
sqlite3-ruby
yard
View
@@ -2,14 +2,16 @@
source "http://rubygems.org"
-gem "rr"
-gem "activerecord", "~> 3.0"
+gem "cucumber", "~> 1.0.0"
gem "rake"
-gem "sqlite3-ruby", :require=>false
-gem "bluecloth"
gem "rspec", "~> 2.0"
-gem "yard"
gem "rcov"
-gem "cucumber", "~> 1.0.0"
+gem "activerecord", "~> 3.0"
+gem "activesupport", :require=>false
+gem "mocha"
+gem "bourne"
+gem "sqlite3-ruby", :require=>false
gem "appraisal", "~> 0.3.5"
+gem "yard"
+gem "bluecloth"
@@ -21,6 +21,8 @@ GEM
cucumber (>= 0.10.5)
rspec (>= 2.6.0)
bluecloth (2.1.0)
+ bourne (1.0)
+ mocha (= 0.9.8)
builder (2.1.2)
childprocess (0.1.9)
ffi (~> 1.0.6)
@@ -36,9 +38,10 @@ GEM
json (>= 1.4.6)
i18n (0.5.0)
json (1.5.3)
+ mocha (0.9.8)
+ rake
rake (0.9.2)
rcov (0.9.9)
- rr (1.0.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
@@ -59,12 +62,14 @@ PLATFORMS
DEPENDENCIES
activerecord (~> 3.0)
+ activesupport
appraisal (~> 0.3.5)
bluecloth
+ bourne
cucumber (~> 1.0.0)
+ mocha
rake
rcov
- rr
rspec (~> 2.0)
sqlite3-ruby
yard
@@ -64,17 +64,17 @@
describe "defining a factory" do
before do
@name = :user
- @factory = "factory"
+ @factory = stub("factory", :names => [@name])
@proxy = "proxy"
- stub(@factory).names { [@name] }
@options = { :class => 'magic' }
- stub(FactoryGirl::Factory).new { @factory }
- stub(FactoryGirl::DefinitionProxy).new { @proxy }
+ FactoryGirl::Factory.stubs(:new => @factory)
+ FactoryGirl::DefinitionProxy.stubs(:new => @proxy)
end
it "should create a new factory using the specified name and options" do
- mock(FactoryGirl::Factory).new(@name, @options) { @factory }
+ FactoryGirl::Factory.stubs(:new => @factory)
Factory.define(@name, @options) {|f| }
+ FactoryGirl::Factory.should have_received(:new).with(@name, @options)
end
it "should pass the factory do the block" do
@@ -100,35 +100,39 @@
end
it "should use Proxy::AttributesFor for Factory.attributes_for" do
- mock(@factory).run(FactoryGirl::Proxy::AttributesFor, :attr => 'value') { 'result' }
+ @factory.stubs(:run => "result")
Factory.attributes_for(@name, :attr => 'value').should == 'result'
+ @factory.should have_received(:run).with(FactoryGirl::Proxy::AttributesFor, :attr => 'value')
end
it "should use Proxy::Build for Factory.build" do
- mock(@factory).run(FactoryGirl::Proxy::Build, :attr => 'value') { 'result' }
+ @factory.stubs(:run => "result")
Factory.build(@name, :attr => 'value').should == 'result'
+ @factory.should have_received(:run).with(FactoryGirl::Proxy::Build, :attr => 'value')
end
it "should use Proxy::Create for Factory.create" do
- mock(@factory).run(FactoryGirl::Proxy::Create, :attr => 'value') { 'result' }
+ @factory.stubs(:run => "result")
Factory.create(@name, :attr => 'value').should == 'result'
+ @factory.should have_received(:run).with(FactoryGirl::Proxy::Create, :attr => 'value')
end
it "should use Proxy::Stub for Factory.stub" do
- mock(@factory).run(FactoryGirl::Proxy::Stub, :attr => 'value') { 'result' }
+ @factory.stubs(:run => "result")
Factory.stub(@name, :attr => 'value').should == 'result'
+ @factory.should have_received(:run).with(FactoryGirl::Proxy::Stub, :attr => 'value')
end
it "should use default strategy option as Factory.default_strategy" do
- stub(@factory).default_strategy { :create }
- mock(@factory).run(FactoryGirl::Proxy::Create, :attr => 'value') { 'result' }
+ @factory.stubs(:default_strategy => :create, :run => "result")
Factory.default_strategy(@name, :attr => 'value').should == 'result'
+ @factory.should have_received(:run).with(FactoryGirl::Proxy::Create, :attr => 'value')
end
it "should use the default strategy for the global Factory method" do
- stub(@factory).default_strategy { :create }
- mock(@factory).run(FactoryGirl::Proxy::Create, :attr => 'value') { 'result' }
+ @factory.stubs(:default_strategy => :create, :run => "result")
Factory(@name, :attr => 'value').should == 'result'
+ @factory.should have_received(:run).with(FactoryGirl::Proxy::Create, :attr => 'value')
end
[:build, :create, :attributes_for, :stub].each do |method|
@@ -137,7 +141,7 @@
end
it "should recognize either 'name' or :name for Factory.#{method}" do
- stub(@factory).run
+ @factory.stubs(:run)
lambda { Factory.send(method, @name.to_s) }.should_not raise_error
lambda { Factory.send(method, @name.to_sym) }.should_not raise_error
end
@@ -146,26 +150,22 @@
describe "defining a sequence" do
before do
- @name = :count
- @sequence = FactoryGirl::Sequence.new(@name) {}
- stub(FactoryGirl::Sequence).new { @sequence }
+ @name = :count
end
it "should create a new sequence" do
- mock(FactoryGirl::Sequence).new(@name, 1) { @sequence }
Factory.sequence(@name)
+ Factory.next(@name).should == 1
end
it "should use the supplied block as the sequence generator" do
- stub(FactoryGirl::Sequence).new { @sequence }.yields(1)
- yielded = false
- Factory.sequence(@name) {|n| yielded = true }
- (yielded).should be
+ Factory.sequence(@name) {|n| "user-#{n}" }
+ Factory.next(@name).should == "user-1"
end
it "should use the supplied start_value as the sequence start_value" do
- mock(FactoryGirl::Sequence).new(@name, "A") { @sequence }
Factory.sequence(@name, "A")
+ Factory.next(@name).should == "A"
end
end
@@ -175,16 +175,15 @@
@sequence = FactoryGirl::Sequence.new(@name) {}
@value = '1 2 5'
- stub(@sequence).next { @value }
- stub(FactoryGirl::Sequence).new { @sequence }
+ @sequence.stubs(:next => @value)
+ FactoryGirl::Sequence.stubs(:new => @sequence)
Factory.sequence(@name) {}
end
it "should call next on the sequence when sent next" do
- mock(@sequence).next
-
Factory.next(@name)
+ @sequence.should have_received(:next)
end
it "should return the value from the sequence" do
@@ -21,10 +21,9 @@
end
it "should tell the proxy to associate when being added to a proxy" do
- proxy = "proxy"
- stub(proxy).associate
+ proxy = stub("proxy", :associate => nil)
@attr.add_to(proxy)
- proxy.should have_received.associate(@name, @factory, @overrides)
+ proxy.should have_received(:associate).with(@name, @factory, @overrides)
end
it "should convert names to symbols" do
@@ -12,9 +12,9 @@
end
it "should set its callback on a proxy" do
- @proxy = "proxy"
- mock(@proxy).add_callback(@name, @block)
- @attr.add_to(@proxy)
+ proxy = stub("proxy", :add_callback => true)
+ @attr.add_to(proxy)
+ proxy.should have_received(:add_callback).with(@name, @block)
end
it "should convert names to symbols" do
Oops, something went wrong.

1 comment on commit 554e6ab

Contributor

justinko commented on 554e6ab Aug 13, 2011

Good move.

Please sign in to comment.