spec/examples/blog_spec.rb in tumblr_client-0.8.4 vs spec/examples/blog_spec.rb in tumblr_client-0.8.5

- old
+ new

@@ -9,53 +9,53 @@ end describe :blog_info do it 'should make the proper request' do - client.should_receive(:get).once.with("v2/blog/#{blog_name}/info", { + expect(client).to receive(:get).once.with("v2/blog/#{blog_name}/info", { :api_key => consumer_key }).and_return 'response' r = client.blog_info blog_name - r.should == 'response' + expect(r).to eq('response') end it 'should make the proper request with a short blog name' do - client.should_receive(:get).once.with("v2/blog/b.tumblr.com/info", { + expect(client).to receive(:get).once.with("v2/blog/b.tumblr.com/info", { :api_key => consumer_key }).and_return 'response' r = client.blog_info 'b' - r.should == 'response' + expect(r).to eq('response') end end describe :avatar do context 'when supplying a size' do before do - client.should_receive(:get_redirect_url).once.with("v2/blog/#{blog_name}/avatar/128"). + expect(client).to receive(:get_redirect_url).once.with("v2/blog/#{blog_name}/avatar/128"). and_return('url') end it 'should construct the request properly' do r = client.avatar blog_name, 128 - r.should == 'url' + expect(r).to eq('url') end end context 'when no size is specified' do before do - client.should_receive(:get_redirect_url).once.with("v2/blog/#{blog_name}/avatar"). + expect(client).to receive(:get_redirect_url).once.with("v2/blog/#{blog_name}/avatar"). and_return('url') end it 'should construct the request properly' do r = client.avatar blog_name - r.should == 'url' + expect(r).to eq('url') end end end @@ -63,28 +63,28 @@ describe :followers do context 'with invalid parameters' do it 'should raise an error' do - lambda { + expect(lambda { client.followers blog_name, :not => 'an option' - }.should raise_error ArgumentError + }).to raise_error ArgumentError end end context 'with valid parameters' do before do - client.should_receive(:get).once.with("v2/blog/#{blog_name}/followers", { + expect(client).to receive(:get).once.with("v2/blog/#{blog_name}/followers", { :limit => 1 }).and_return('response') end it 'should construct the request properly' do r = client.followers blog_name, :limit => 1 - r.should == 'response' + expect(r).to eq'response' end end end @@ -92,29 +92,29 @@ describe :blog_likes do context 'with invalid parameters' do it 'should raise an error' do - lambda { + expect(lambda { client.blog_likes blog_name, :not => 'an option' - }.should raise_error ArgumentError + }).to raise_error ArgumentError end end context 'with valid parameters' do before do - client.should_receive(:get).once.with("v2/blog/#{blog_name}/likes", { + expect(client).to receive(:get).once.with("v2/blog/#{blog_name}/likes", { :limit => 1, :api_key => consumer_key }).and_return('response') end it 'should construct the request properly' do r = client.blog_likes blog_name, :limit => 1 - r.should == 'response' + expect(r).to eq('response') end end end @@ -122,36 +122,36 @@ describe :posts do context 'without a type supplied' do before do - client.should_receive(:get).once.with("v2/blog/#{blog_name}/posts", { + expect(client).to receive(:get).once.with("v2/blog/#{blog_name}/posts", { :limit => 1, :api_key => consumer_key }).and_return('response') end it 'should construct the request properly' do r = client.posts blog_name, :limit => 1 - r.should == 'response' + expect(r).to eq('response') end end context 'when supplying a type' do before do - client.should_receive(:get).once.with("v2/blog/#{blog_name}/posts/audio", { + expect(client).to receive(:get).once.with("v2/blog/#{blog_name}/posts/audio", { :limit => 1, :api_key => consumer_key, :type => 'audio' }).and_return('response') end it 'should construct the request properly' do r = client.posts blog_name, :limit => 1, :type => 'audio' - r.should == 'response' + expect(r).to eq('response') end end end @@ -164,25 +164,25 @@ describe type do context 'when using parameters other than limit & offset' do it 'should raise an error' do - lambda { + expect(lambda { client.send type, blog_name, :not => 'an option' - }.should raise_error ArgumentError + }).to raise_error ArgumentError end end context 'with valid options' do it 'should construct the call properly' do limit = 5 - client.should_receive(:get).once.with("v2/blog/#{blog_name}/posts/#{ext}", { + expect(client).to receive(:get).once.with("v2/blog/#{blog_name}/posts/#{ext}", { :limit => limit }).and_return('response') r = client.send type, blog_name, :limit => limit - r.should == 'response' + expect(r).to eq('response') end end end