diff --git a/spec/couchrest_spec.rb b/spec/couchrest_spec.rb index 1bfc729..edcce63 100644 --- a/spec/couchrest_spec.rb +++ b/spec/couchrest_spec.rb @@ -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 diff --git a/spec/database_spec.rb b/spec/database_spec.rb index 2ea09e4..ed66a58 100644 --- a/spec/database_spec.rb +++ b/spec/database_spec.rb @@ -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 = @cr.database(TESTDB) + @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 diff --git a/spec/pager_spec.rb b/spec/pager_spec.rb index f1c5b4d..f7662bf 100644 --- a/spec/pager_spec.rb +++ b/spec/pager_spec.rb @@ -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