Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Updating all dependencies #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
--color
--format=nested
--format=documentation
--backtrace
14 changes: 7 additions & 7 deletions instagram.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
require File.expand_path('../lib/instagram/version', __FILE__)

Gem::Specification.new do |s|
s.add_development_dependency('rake', '~> 0.9.2.2')
s.add_development_dependency('rspec', '~> 2.4')
s.add_development_dependency('webmock', '~> 1.6')
s.add_development_dependency('rake', '~> 10.5.0')
s.add_development_dependency('rspec', '~> 3.4.0')
s.add_development_dependency('webmock', '~> 1.22.6')
s.add_development_dependency('bluecloth', '~> 2.2.0')
s.add_runtime_dependency('faraday', ['>= 0.7', '< 0.10'])
s.add_runtime_dependency('faraday_middleware', ['>= 0.8', '< 0.10'])
s.add_runtime_dependency('multi_json', '>= 1.0.3', '~> 1.0')
s.add_runtime_dependency('hashie', '>= 0.4.0')
s.add_runtime_dependency('faraday', '~> 0.9.2')
s.add_runtime_dependency('faraday_middleware', '~> 0.10.0')
s.add_runtime_dependency('multi_json', '~> 1.11.2')
s.add_runtime_dependency('hashie', '~> 3.4.3')
s.authors = ["Shayne Sweeney"]
s.description = %q{A Ruby wrapper for the Instagram REST and Search APIs}
s.post_install_message =<<eos
Expand Down
1 change: 1 addition & 0 deletions lib/instagram/response.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Instagram
module Response
def self.create( response_hash, ratelimit_hash )
response_hash = {} unless response_hash
data = response_hash.data.dup rescue response_hash
data.extend( self )
data.instance_exec do
Expand Down
12 changes: 6 additions & 6 deletions spec/faraday/response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
end

it "should raise #{exception.name} error" do
lambda do
expect do
@client.user_media_feed()
end.should raise_error(exception)
end.to raise_error(exception)
end

end
Expand Down Expand Up @@ -63,9 +63,9 @@
end

it 'should raise an Instagram::BadGateway' do
lambda do
expect do
@client.user_media_feed()
end.should raise_error(Instagram::BadGateway)
end.to raise_error(Instagram::BadGateway)
end
end

Expand All @@ -78,9 +78,9 @@
end

it 'should raise an Instagram::GatewayTimeout' do
lambda do
expect do
@client.user_media_feed()
end.should raise_error(Instagram::GatewayTimeout)
end.to raise_error(Instagram::GatewayTimeout)
end
end
end
48 changes: 24 additions & 24 deletions spec/instagram/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
it "should inherit module configuration" do
api = Instagram::API.new
@keys.each do |key|
api.send(key).should == key
expect(api.send(key)).to eq(key)
end
end

Expand Down Expand Up @@ -53,7 +53,7 @@
it "should override module configuration" do
api = Instagram::API.new(@configuration)
@keys.each do |key|
api.send(key).should == @configuration[key]
expect(api.send(key)).to eq(@configuration[key])
end
end

Expand All @@ -69,13 +69,13 @@

it "should override module configuration after initialization" do
@keys.each do |key|
api.send(key).should == @configuration[key]
expect(api.send(key)).to eq(@configuration[key])
end
end

describe "#connection" do
it "should use the connection_options" do
Faraday::Connection.should_receive(:new).with(include(:ssl => { :verify => true }))
expect(Faraday::Connection).to receive(:new).with(include(:ssl => { :verify => true }))
api.send(:connection)
end
end
Expand All @@ -94,7 +94,7 @@
@keys.each do |key|
subject.send("#{key}=", key)
end
subject.config.should == config
expect(subject.config).to eq(config)
end
end

Expand All @@ -116,15 +116,15 @@

url2 = client.send(:connection).build_url("/oauth/authorize/", params2).to_s

url2.should == url
expect(url2).to eq(url)
end

it "should not include client secret in URL params" do
params = { :client_id => "CID", :client_secret => "CS" }
client = Instagram::Client.new(params)
redirect_uri = 'http://localhost:4567/oauth/callback'
url = client.authorize_url(:redirect_uri => redirect_uri)
url.should_not include("client_secret")
expect(url).not_to include("client_secret")
end

describe "scope param" do
Expand All @@ -133,15 +133,15 @@
client = Instagram::Client.new(params)
redirect_uri = 'http://localhost:4567/oauth/callback'
url = client.authorize_url(:redirect_uri => redirect_uri)
url.should include("scope")
expect(url).to include("scope")
end

it "should not include the scope if the scope is blank" do
params = { :scope => "" }
client = Instagram::Client.new(params)
redirect_uri = 'http://localhost:4567/oauth/callback'
url = client.authorize_url(:redirect_uri => redirect_uri)
url.should_not include("scope")
expect(url).not_to include("scope")
end
end

Expand All @@ -151,7 +151,7 @@
params = { :redirect_uri => redirect_uri }
client = Instagram::Client.new(params)
url = client.authorize_url()
url.should =~ /redirect_uri=#{URI.escape(redirect_uri, Regexp.union('/',':'))}/
expect(url).to match(/redirect_uri=#{URI.escape(redirect_uri, Regexp.union('/',':'))}/)
end

it "should override configuration redirect_uri if passed as option" do
Expand All @@ -161,7 +161,7 @@
redirect_uri_option = 'http://localhost:4567/oauth/callback_option'
options = { :redirect_uri => redirect_uri_option }
url = client.authorize_url(options)
url.should =~ /redirect_uri=#{URI.escape(redirect_uri_option, Regexp.union('/',':'))}/
expect(url).to match(/redirect_uri=#{URI.escape(redirect_uri_option, Regexp.union('/',':'))}/)
end
end
end
Expand All @@ -179,15 +179,15 @@

it "should get the correct resource" do
@client.get_access_token(code="C", :redirect_uri => "http://localhost:4567/oauth/callback")
a_request(:post, @url).
with(:body => {:client_id => "CID", :client_secret => "CS", :redirect_uri => "http://localhost:4567/oauth/callback", :grant_type => "authorization_code", :code => "C"}).
should have_been_made
expect(a_request(:post, @url).
with(:body => {:client_id => "CID", :client_secret => "CS", :redirect_uri => "http://localhost:4567/oauth/callback", :grant_type => "authorization_code", :code => "C"})).
to have_been_made
end

it "should return a hash with an access_token and user data" do
response = @client.get_access_token(code="C", :redirect_uri => "http://localhost:4567/oauth/callback")
response.access_token.should == "at"
response.user.username.should == "mikeyk"
expect(response.access_token).to eq("at")
expect(response.user.username).to eq("mikeyk")
end
end

Expand All @@ -202,17 +202,17 @@

it "should fall back to configuration redirect_uri if not passed as option" do
@client.get_access_token(code="C")
a_request(:post, @url).
with(:body => hash_including({:redirect_uri => @redirect_uri_config})).
should have_been_made
expect(a_request(:post, @url).
with(:body => hash_including({:redirect_uri => @redirect_uri_config}))).
to have_been_made
end

it "should override configuration redirect_uri if passed as option" do
redirect_uri_option = "http://localhost:4567/oauth/callback_option"
@client.get_access_token(code="C", :redirect_uri => redirect_uri_option)
a_request(:post, @url).
with(:body => hash_including({:redirect_uri => redirect_uri_option})).
should have_been_made
expect(a_request(:post, @url).
with(:body => hash_including({:redirect_uri => redirect_uri_option}))).
to have_been_made
end
end

Expand Down Expand Up @@ -266,8 +266,8 @@
end

it "should redact API keys" do
ENV.stub(:[]).with('http_proxy').and_return(nil)
ENV.stub(:[]).with('INSTAGRAM_GEM_REDACT').and_return('true')
allow(ENV).to receive(:[]).with('http_proxy').and_return(nil)
allow(ENV).to receive(:[]).with('INSTAGRAM_GEM_REDACT').and_return('true')

output = capture_output do
@client.user_media_feed()
Expand Down
24 changes: 12 additions & 12 deletions spec/instagram/client/comments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

it "should get the correct resource" do
@client.media_comments(777)
a_get("media/777/comments.#{format}").
with(:query => {:access_token => @client.access_token}).
should have_been_made
expect(a_get("media/777/comments.#{format}").
with(:query => {:access_token => @client.access_token})).
to have_been_made
end

it "should return an array of user search results" do
comments = @client.media_comments(777)
comments.should be_a Array
comments.first.text.should == "Vet visit"
expect(comments).to be_a Array
expect(comments.first.text).to eq("Vet visit")
end
end

Expand All @@ -40,14 +40,14 @@

it "should get the correct resource" do
@client.create_media_comment(777, "hi there")
a_post("media/777/comments.#{format}").
with(:body => {:text => "hi there", :access_token => @client.access_token}).
should have_been_made
expect(a_post("media/777/comments.#{format}").
with(:body => {:text => "hi there", :access_token => @client.access_token})).
to have_been_made
end

it "should return the new comment when successful" do
comment = @client.create_media_comment(777, "hi there")
comment.text.should == "hi there"
expect(comment.text).to eq("hi there")
end
end

Expand All @@ -61,9 +61,9 @@

it "should get the correct resource" do
@client.delete_media_comment(777, 1234)
a_delete("media/777/comments/1234.#{format}").
with(:query => {:access_token => @client.access_token}).
should have_been_made
expect(a_delete("media/777/comments/1234.#{format}").
with(:query => {:access_token => @client.access_token})).
to have_been_made
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/instagram/client/embedding_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@

it "should get the correct resource" do
@client.oembed("http://instagram.com/p/abcdef")
a_get("oembed?url=http://instagram.com/p/abcdef").
with(:query => {:access_token => @client.access_token}).
should have_been_made
expect(a_get("oembed?url=http://instagram.com/p/abcdef").
with(:query => {:access_token => @client.access_token})).
to have_been_made
end

it "should return the oembed information for an instagram media url" do
oembed = @client.oembed("http://instagram.com/p/abcdef")
oembed.media_id.should == "123657555223544123_41812344"
expect(oembed.media_id).to eq("123657555223544123_41812344")
end

it "should return nil if a URL is not provided" do
oembed = @client.oembed
oembed.should be_nil
expect(oembed).to be_nil
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/instagram/client/geography_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

it "should get the correct resource" do
@client.geography_recent_media(12345)
a_get("geographies/12345/media/recent.#{format}").
with(:query => {:access_token => @client.access_token}).
should have_been_made
expect(a_get("geographies/12345/media/recent.#{format}").
with(:query => {:access_token => @client.access_token})).
to have_been_made
end

it "should return a list of recent media items within the specifed geography" do
recent_media = @client.geography_recent_media(12345)
recent_media.should be_a Array
recent_media.first.user.username.should == "amandavan"
expect(recent_media).to be_a Array
expect(recent_media.first.user.username).to eq("amandavan")
end
end
end
Expand Down
22 changes: 11 additions & 11 deletions spec/instagram/client/likes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

it "should get the correct resource" do
@client.media_likes(777)
a_get("media/777/likes.#{format}").
with(:query => {:access_token => @client.access_token}).
should have_been_made
expect(a_get("media/777/likes.#{format}").
with(:query => {:access_token => @client.access_token})).
to have_been_made
end

it "should return an array of user search results" do
comments = @client.media_likes(777)
comments.should be_a Array
comments.first.username.should == "chris"
expect(comments).to be_a Array
expect(comments.first.username).to eq("chris")
end
end

Expand All @@ -40,9 +40,9 @@

it "should get the correct resource" do
@client.like_media(777)
a_post("media/777/likes.#{format}").
with(:body => {:access_token => @client.access_token}).
should have_been_made
expect(a_post("media/777/likes.#{format}").
with(:body => {:access_token => @client.access_token})).
to have_been_made
end
end

Expand All @@ -56,9 +56,9 @@

it "should get the correct resource" do
@client.unlike_media(777)
a_delete("media/777/likes.#{format}").
with(:query => {:access_token => @client.access_token}).
should have_been_made
expect(a_delete("media/777/likes.#{format}").
with(:query => {:access_token => @client.access_token})).
to have_been_made
end
end
end
Expand Down
Loading