spec/examples/client_spec.rb in tumblr_client-0.8.4 vs spec/examples/client_spec.rb in tumblr_client-0.8.5
- old
+ new
@@ -11,20 +11,20 @@
end
end
it 'should give new clients those credentials' do
client = Tumblr::Client.new
- client.credentials[:consumer_key].should == @key
+ expect(client.credentials[:consumer_key]).to eq(@key)
end
it 'should have it\'s own credentials' do
- Tumblr.credentials[:consumer_key].should == @key
+ expect(Tumblr.credentials[:consumer_key]).to eq(@key)
end
it 'should be able to make a new client (using these credentials)' do
- Tumblr.new.should be_a(Tumblr::Client)
- Tumblr.new.credentials[:consumer_key].should == @key
+ expect(Tumblr.new).to be_a(Tumblr::Client)
+ expect(Tumblr.new.credentials[:consumer_key]).to eq(@key)
end
end
context 'when using custom copies of the client' do
@@ -33,13 +33,33 @@
@client1 = Tumblr::Client.new(:consumer_key => 'key1')
@client2 = Tumblr::Client.new(:consumer_key => 'key2')
end
it 'should keep them separate' do
- [
+ expect([
@client1.credentials[:consumer_key],
@client2.credentials[:consumer_key]
- ].uniq.count.should == 2
+ ].uniq.count).to eq(2)
+ end
+
+ end
+
+ describe :api_scheme do
+
+ it 'defaults to https' do
+ expect(Tumblr::Client.new.api_scheme).to eq('https')
+ end
+
+ it 'can be set by the initializer' do
+ client = Tumblr::Client.new(:api_scheme => 'http')
+ expect(client.api_scheme).to eq('http')
+ end
+
+ it 'can be set globally' do
+ Tumblr.configure do |c|
+ c.api_scheme = 'http'
+ end
+ expect(Tumblr::Client.new.api_scheme).to eq('http')
end
end
end