s/localhost/127.0.0.1/

This commit is contained in:
Jan Lehnardt 2008-12-14 12:05:02 +01:00
parent 12c09085df
commit 7461e3fede
16 changed files with 46 additions and 46 deletions

View file

@ -46,48 +46,48 @@ describe CouchRest do
it "should parse just a dbname" do
db = CouchRest.parse "my-db"
db[:database].should == "my-db"
db[:host].should == "localhost:5984"
db[:host].should == "127.0.0.1:5984"
end
it "should parse a host and db" do
db = CouchRest.parse "localhost/my-db"
db = CouchRest.parse "127.0.0.1/my-db"
db[:database].should == "my-db"
db[:host].should == "localhost"
db[:host].should == "127.0.0.1"
end
it "should parse a host and db with http" do
db = CouchRest.parse "http://localhost/my-db"
db = CouchRest.parse "http://127.0.0.1/my-db"
db[:database].should == "my-db"
db[:host].should == "localhost"
db[:host].should == "127.0.0.1"
end
it "should parse a host with a port and db" do
db = CouchRest.parse "localhost:5555/my-db"
db = CouchRest.parse "127.0.0.1:5555/my-db"
db[:database].should == "my-db"
db[:host].should == "localhost:5555"
db[:host].should == "127.0.0.1:5555"
end
it "should parse a host with a port and db with http" do
db = CouchRest.parse "http://localhost:5555/my-db"
db = CouchRest.parse "http://127.0.0.1:5555/my-db"
db[:database].should == "my-db"
db[:host].should == "localhost:5555"
db[:host].should == "127.0.0.1:5555"
end
it "should parse just a host" do
db = CouchRest.parse "http://localhost:5555/"
db = CouchRest.parse "http://127.0.0.1:5555/"
db[:database].should be_nil
db[:host].should == "localhost:5555"
db[:host].should == "127.0.0.1:5555"
end
it "should parse just a host no slash" do
db = CouchRest.parse "http://localhost:5555"
db[:host].should == "localhost:5555"
db = CouchRest.parse "http://127.0.0.1:5555"
db[:host].should == "127.0.0.1:5555"
db[:database].should be_nil
end
it "should get docid" do
db = CouchRest.parse "localhost:5555/my-db/my-doc"
db = CouchRest.parse "127.0.0.1:5555/my-db/my-doc"
db[:database].should == "my-db"
db[:host].should == "localhost:5555"
db[:host].should == "127.0.0.1:5555"
db[:doc].should == "my-doc"
end
it "should get docid with http" do
db = CouchRest.parse "http://localhost:5555/my-db/my-doc"
db = CouchRest.parse "http://127.0.0.1:5555/my-db/my-doc"
db[:database].should == "my-db"
db[:host].should == "localhost:5555"
db[:host].should == "127.0.0.1:5555"
db[:doc].should == "my-doc"
end
@ -137,24 +137,24 @@ describe CouchRest do
describe "easy initializing a database adapter" do
it "should be possible without an explicit CouchRest instantiation" do
db = CouchRest.database "http://localhost:5984/couchrest-test"
db = CouchRest.database "http://127.0.0.1:5984/couchrest-test"
db.should be_an_instance_of(CouchRest::Database)
db.host.should == "localhost:5984"
db.host.should == "127.0.0.1:5984"
end
# TODO add https support (need test environment...)
# it "should work with https" # do
# db = CouchRest.database "https://localhost:5984/couchrest-test"
# db.host.should == "https://localhost:5984"
# db = CouchRest.database "https://127.0.0.1:5984/couchrest-test"
# db.host.should == "https://127.0.0.1:5984"
# end
it "should not create the database automatically" do
db = CouchRest.database "http://localhost:5984/couchrest-test"
db = CouchRest.database "http://127.0.0.1:5984/couchrest-test"
lambda{db.info}.should raise_error(RestClient::ResourceNotFound)
end
end
describe "ensuring the db exists" do
it "should be super easy" do
db = CouchRest.database! "http://localhost:5984/couchrest-test-2"
db = CouchRest.database! "http://127.0.0.1:5984/couchrest-test-2"
db.name.should == 'couchrest-test-2'
db.info["db_name"].should == 'couchrest-test-2'
end