Sha256: 9c26d7c25dde3164ddb80b46993825fd6bb72b64e4489b0834592442c0791b33
Contents?: true
Size: 867 Bytes
Versions: 12
Compression:
Stored size: 867 Bytes
Contents
require 'spec_helper' require 'couch_potato/rspec' class WithStubbedView include CouchPotato::Persistence view :stubbed_view, :key => :x end describe "stubbing the db" do it "should replace CouchPotato.database with a stub" do stub_db CouchPotato.database.should be_a(RSpec::Mocks::Mock) end it "should return the stub" do db = stub_db CouchPotato.database.should == db end end describe "stubbing a view" do before(:each) do @db = stub_db @db.stub_view(WithStubbedView, :stubbed_view).with('123').and_return([:result]) end it "should stub the view to return a stub" do WithStubbedView.stubbed_view('123').should be_a(RSpec::Mocks::Mock) end it "should stub the database to return fake results when called with the stub" do @db.view(WithStubbedView.stubbed_view('123')).should == [:result] end end
Version data entries
12 entries across 12 versions & 2 rubygems