Sha256: 6cf859cb3258dfec3c3a7c6ae307b3068cf35c4dcfcdba232bdf3c0462d0f126
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
require 'spec_helper' describe Tinder::Connection do describe "authentication" do it "should raise an exception with bad credentials" do FakeWeb.register_uri(:get, "https://foo:X@test.campfirenow.com/rooms.json", :status => ["401", "Unauthorized"]) connection = Tinder::Connection.new('test', :token => 'foo') lambda { connection.get('/rooms.json') }.should raise_error(Tinder::AuthenticationFailed) end it "should lookup token when username/password provided" do FakeWeb.register_uri(:get, "https://user:pass@test.campfirenow.com/users/me.json", :body => fixture('users/me.json'), :content_type => "application/json") connection = Tinder::Connection.new('test', :username => 'user', :password => 'pass') connection.token.should.should == "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" end it "should use basic auth for credentials" do FakeWeb.register_uri(:get, "https://mytoken:X@test.campfirenow.com/rooms.json", :body => fixture('rooms.json'), :content_type => "application/json") connection = Tinder::Connection.new('test', :token => 'mytoken') lambda { connection.get('/rooms.json') }.should_not raise_error end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tinder-1.4.1 | spec/tinder/connection_spec.rb |