Created
March 29, 2011 22:22
-
-
Save dcrec1/893477 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe Foo | |
| describe ".setup" do | |
| it "should capture a Mongo connection for the specified environment host" do | |
| Mongo::Connection.stub(:new) { |param| param.should == host } | |
| Foo.setup config, environment | |
| end | |
| end | |
| describe ".connection" do | |
| it "should assign to the Mongo connection the host for the specified environment" do | |
| Foo.setup(config, environment).connection.host.should == host | |
| end | |
| end | |
| end | |
| describe Foo | |
| let ... | |
| describe ".setup" do | |
| it "should init a new Mongo connection for the specified environment host" do | |
| Mongo::Connection.should_receive(:new).with(host) | |
| Foo.setup config, :test | |
| end | |
| end | |
| describe ".connection" do | |
| it "should return the created Mongo connection on setup" do | |
| Mongo::Connection.stub(:new).and_return(connection) | |
| Foo.setup config, :test | |
| Foot.connection.should == connection | |
| end | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment