Sha256: 177f595d6efe072be6eb9c99ceb6ae6bcb1b1ec7b108e86a6ccd4a26fc5edb43
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
require 'spec_helper' describe Sources::Couch do context "without database" do it "should fail correctly" do lambda { @source = Sources::Couch.new(:a, :b, :c) }.should raise_error(Sources::NoCouchDBGiven) end end context "with database" do before(:each) do @source = Sources::Couch.new :a, :b, :c, url: 'http://localhost:5984/picky' RestClient::Request.should_receive(:execute).any_number_of_times.and_return %{{"rows":[{"doc":{"_id":"7","a":"a data","b":"b data","c":"c data"}}]}} end describe "harvest" do it "should yield the right data" do field = stub :b, :name => :b @source.harvest :anything, field do |id, token| id.should eql(7) token.should eql('b data') end.should have(1).item end end describe "get_data" do it "should yield each line" do @source.get_data do |data| data.should == { "_id" => "7", "a" => "a data", "b" => "b data", "c" => "c data" } end.should have(1).item end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
picky-0.11.2 | spec/lib/sources/couch_spec.rb |
picky-0.11.1 | spec/lib/sources/couch_spec.rb |
picky-0.11.0 | spec/lib/sources/couch_spec.rb |
picky-0.10.5 | spec/lib/sources/couch_spec.rb |