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)
begin
@db = @cr.database(TESTDB)
@db.delete!
rescue RestClient::Request::RequestFailed
@db.delete! rescue nil
end
end
after(:each) do
begin
@db.delete!
rescue RestClient::Request::RequestFailed
@db.delete! rescue nil
end
end

View file

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

View file

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