updated rescues for better rest-client

This commit is contained in:
Chris Anderson 2008-07-19 15:25:02 -04:00
parent 85b38bb3f7
commit eecd92a6ef
3 changed files with 10 additions and 24 deletions

View file

@ -6,16 +6,13 @@ describe CouchRest do
@cr = CouchRest.new(COUCHHOST) @cr = CouchRest.new(COUCHHOST)
begin begin
@db = @cr.database(TESTDB) @db = @cr.database(TESTDB)
@db.delete! @db.delete! rescue nil
rescue RestClient::Request::RequestFailed
end end
end end
after(:each) do after(:each) do
begin begin
@db.delete! @db.delete! rescue nil
rescue RestClient::Request::RequestFailed
end end
end end

View file

@ -3,15 +3,9 @@ require File.dirname(__FILE__) + '/spec_helper'
describe CouchRest::Database do describe CouchRest::Database do
before(:each) do before(:each) do
@cr = CouchRest.new(COUCHHOST) @cr = CouchRest.new(COUCHHOST)
begin @db = @cr.database(TESTDB)
@db = @cr.database(TESTDB) @db.delete! rescue nil
@db.delete! @db = @cr.create_db(TESTDB) rescue nil
rescue RestClient::Request::RequestFailed
end
begin
@db = @cr.create_db(TESTDB)
rescue RestClient::Request::RequestFailed
end
end end
describe "map query with _temp_view in Javascript" do describe "map query with _temp_view in Javascript" do
@ -162,11 +156,11 @@ describe CouchRest::Database do
{"_id" => "twoB", "mild" => "yet local"}, {"_id" => "twoB", "mild" => "yet local"},
{"another" => ["set","of","keys"]} {"another" => ["set","of","keys"]}
]) ])
end.should raise_error(RestClient::Request::RequestFailed) end.should raise_error(RestClient::RequestFailed)
lambda do lambda do
@db.get('twoB') @db.get('twoB')
end.should raise_error(RestClient::Request::RequestFailed) end.should raise_error(RestClient::ResourceNotFound)
end end
end end

View file

@ -3,14 +3,9 @@ require File.dirname(__FILE__) + '/spec_helper'
describe CouchRest::Pager do describe CouchRest::Pager do
before(:all) do before(:all) do
@cr = CouchRest.new(COUCHHOST) @cr = CouchRest.new(COUCHHOST)
begin @db = @cr.database(TESTDB)
@cr.database(TESTDB).delete! @db.delete! rescue nil
rescue RestClient::Request::RequestFailed @db = @cr.create_db(TESTDB) rescue nil
end
begin
@db = @cr.create_db(TESTDB)
rescue RestClient::Request::RequestFailed
end
@pager = CouchRest::Pager.new(@db) @pager = CouchRest::Pager.new(@db)
end end