giphy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.md +22 -0
- data/README.md +126 -0
- data/Rakefile +7 -0
- data/bin/giphy +12 -0
- data/giphy.gemspec +26 -0
- data/lib/giphy.rb +8 -0
- data/lib/giphy/artist.rb +35 -0
- data/lib/giphy/cli.rb +23 -0
- data/lib/giphy/client.rb +72 -0
- data/lib/giphy/configuration.rb +23 -0
- data/lib/giphy/errors/api.rb +5 -0
- data/lib/giphy/errors/argument_error.rb +5 -0
- data/lib/giphy/favorite_gif.rb +9 -0
- data/lib/giphy/flagged_gif.rb +18 -0
- data/lib/giphy/gif.rb +83 -0
- data/lib/giphy/gif_by_id.rb +34 -0
- data/lib/giphy/image.rb +31 -0
- data/lib/giphy/null_image.rb +23 -0
- data/lib/giphy/request.rb +56 -0
- data/lib/giphy/response.rb +27 -0
- data/lib/giphy/search.rb +85 -0
- data/lib/giphy/special_gif.rb +25 -0
- data/lib/giphy/version.rb +3 -0
- data/spec/fixtures/giphy.rb +3 -0
- data/spec/giphy/artist_spec.rb +32 -0
- data/spec/giphy/cli_spec.rb +17 -0
- data/spec/giphy/client_spec.rb +94 -0
- data/spec/giphy/configuration_spec.rb +34 -0
- data/spec/giphy/favorite_gif_spec.rb +28 -0
- data/spec/giphy/flagged_gif_spec.rb +34 -0
- data/spec/giphy/gif_by_id_spec.rb +40 -0
- data/spec/giphy/gif_spec.rb +89 -0
- data/spec/giphy/image_spec.rb +32 -0
- data/spec/giphy/null_image_spec.rb +11 -0
- data/spec/giphy/request_spec.rb +49 -0
- data/spec/giphy/response_spec.rb +43 -0
- data/spec/giphy/search_spec.rb +111 -0
- data/spec/giphy/special_gif_spec.rb +15 -0
- data/spec/shared_examples/special_gif_contract_spec.rb +29 -0
- data/spec/spec_helper.rb +6 -0
- metadata +175 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Giphy::Configuration do
|
4
|
+
|
5
|
+
describe ".configure" do
|
6
|
+
it "allows setting version and api_key values" do
|
7
|
+
Giphy::Configuration.configure do |config|
|
8
|
+
config.version = 'v2'
|
9
|
+
config.api_key = '123qwe'
|
10
|
+
end
|
11
|
+
|
12
|
+
expect(Giphy::Configuration.version).to eq 'v2'
|
13
|
+
expect(Giphy::Configuration.api_key).to eq '123qwe'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".version" do
|
18
|
+
context "when no specific version is configured" do
|
19
|
+
it "returns the default version" do
|
20
|
+
Giphy::Configuration.configure { |g| g.version = nil }
|
21
|
+
expect(Giphy::Configuration.version).to eq 'v1'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe ".api_key" do
|
27
|
+
context "when no specific api_key is configured" do
|
28
|
+
it "returns the default api_key" do
|
29
|
+
Giphy::Configuration.configure { |g| g.api_key = nil }
|
30
|
+
expect(Giphy::Configuration.api_key).to eq 'dc6zaTOxFJmzC'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Giphy::FavoriteGif do
|
4
|
+
let(:invalid_hash) { {} }
|
5
|
+
let(:valid_hash) do
|
6
|
+
{ "gif_id" => "12HoHdqnDxz5NS",
|
7
|
+
"api_key" => "dc6zaTOxFJmzC",
|
8
|
+
"tag" => "fun",
|
9
|
+
"create_date" => "2013-06-21 11:51:46"
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
before { @klass = Giphy::FavoriteGif }
|
14
|
+
|
15
|
+
it_should_behave_like "a Giphy::SpecialGif"
|
16
|
+
|
17
|
+
describe "#tag" do
|
18
|
+
context "when initialized with a valid hash" do
|
19
|
+
subject { Giphy::FavoriteGif.new(valid_hash) }
|
20
|
+
its(:tag) { should eq "fun" }
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when initialized with an empty/invalid hash" do
|
24
|
+
subject { Giphy::FavoriteGif.new(invalid_hash) }
|
25
|
+
it { expect{ subject.tag }.to raise_error KeyError }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Giphy::FlaggedGif do
|
4
|
+
let(:invalid_hash) { {} }
|
5
|
+
let(:valid_hash) do
|
6
|
+
{ "gif_id" => "m5QHf0caAwgMw",
|
7
|
+
"api_key" => "dc6zaTOxFJmzC",
|
8
|
+
"is_inappropriate" => "0",
|
9
|
+
"is_wrong_source" => "1",
|
10
|
+
"source_corrected" => "",
|
11
|
+
"create_date" => "2013-08-01 11:27:20"
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
before { @klass = Giphy::FlaggedGif }
|
16
|
+
|
17
|
+
it_should_behave_like "a Giphy::SpecialGif"
|
18
|
+
|
19
|
+
context "when initialized with a valid hash" do
|
20
|
+
subject { Giphy::FlaggedGif.new(valid_hash) }
|
21
|
+
|
22
|
+
its(:inappropriate?) { should be_false }
|
23
|
+
its(:wrong_source?) { should be_true }
|
24
|
+
its(:source_corrected) { should eq "" }
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when initialized with an empty/invalid hash" do
|
28
|
+
subject { Giphy::FlaggedGif.new(invalid_hash) }
|
29
|
+
|
30
|
+
it { expect{ subject.inappropriate? }.to raise_error KeyError }
|
31
|
+
it { expect{ subject.wrong_source? }.to raise_error KeyError }
|
32
|
+
it { expect{ subject.source_corrected }.to raise_error KeyError }
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Giphy::GifByID do
|
4
|
+
subject { Giphy::GifByID.new }
|
5
|
+
|
6
|
+
describe "#get" do
|
7
|
+
let(:gif_hash) { double }
|
8
|
+
let(:gif_object) { double }
|
9
|
+
let(:client) { double(gif: gif_hash, gifs: [gif_hash, gif_hash]) }
|
10
|
+
|
11
|
+
before do
|
12
|
+
Giphy::Client.stub(new: client)
|
13
|
+
Giphy::Gif.stub(:new).with(gif_hash).and_return(gif_object)
|
14
|
+
Giphy::Gif.stub(:build_batch_from).with([gif_hash, gif_hash]).and_return([gif_object, gif_object])
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "#get" do
|
18
|
+
context "when ids size is zero" do
|
19
|
+
it "raises an ArgumentError and sets its error message" do
|
20
|
+
expect{
|
21
|
+
subject.get([])
|
22
|
+
Giphy::Errors::ArgumentError.should_receive(:new).with('wrong number of arguments (0 for 1...Infinite)')
|
23
|
+
}.to raise_error Giphy::Errors::ArgumentError
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "when ids size is one" do
|
28
|
+
it "returns a gif object" do
|
29
|
+
expect( subject.get(['jJgZWn8Z2z4Bi']) ).to eq gif_object
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "when ids size is greates than one" do
|
34
|
+
it "returns an array of gift objects" do
|
35
|
+
expect( subject.get(['jJgZWn8Z2z4Bi', '3avUsGhmckIYE']) ).to eq [gif_object, gif_object]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Giphy::Gif do
|
4
|
+
let(:invalid_hash) { {} }
|
5
|
+
let(:valid_hash) do
|
6
|
+
{ "type" => "gif",
|
7
|
+
"id" => "Pvbwe3TghH6ko",
|
8
|
+
"url" => "http://giphy.com/gifs/Pvbwe3TghH6ko",
|
9
|
+
"bitly_gif_url" => "http://gph.is/18MZ2ya",
|
10
|
+
"bitly_fullscreen_url" => "http://gph.is/18MZ2yc",
|
11
|
+
"bitly_tiled_url" => "http://gph.is/18MZ2ye",
|
12
|
+
"embed_url" => "http://giphy.com/embed/Pvbwe3TghH6ko",
|
13
|
+
"images" => {
|
14
|
+
"fixed_height" => {
|
15
|
+
"url" => "http://media0.giphy.com/media/Pvbwe3TghH6ko/200_d.gif",
|
16
|
+
"width" => "313",
|
17
|
+
"height" => "200"
|
18
|
+
},
|
19
|
+
"fixed_height_still" => {
|
20
|
+
"url" => "http://media0.giphy.com/media/Pvbwe3TghH6ko/200_d.gif",
|
21
|
+
"width" => "313",
|
22
|
+
"height" => "200"
|
23
|
+
},
|
24
|
+
"fixed_height_downsampled" => {
|
25
|
+
"url" => "http://media0.giphy.com/media/Pvbwe3TghH6ko/200_d.gif",
|
26
|
+
"width" => "313",
|
27
|
+
"height" => "200"
|
28
|
+
},
|
29
|
+
"fixed_width" => {
|
30
|
+
"url" => "http://media0.giphy.com/media/Pvbwe3TghH6ko/200w_d.gif",
|
31
|
+
"width" => "200",
|
32
|
+
"height" => "128"
|
33
|
+
},
|
34
|
+
"fixed_width_still" => {
|
35
|
+
"url" => "http://media0.giphy.com/media/Pvbwe3TghH6ko/200w_d.gif",
|
36
|
+
"width" => "200",
|
37
|
+
"height" => "128"
|
38
|
+
},
|
39
|
+
"fixed_width_downsampled" => {
|
40
|
+
"url" => "http://media0.giphy.com/media/Pvbwe3TghH6ko/200w_d.gif",
|
41
|
+
"width" => "200",
|
42
|
+
"height" => "128"
|
43
|
+
},
|
44
|
+
"original" => {
|
45
|
+
"url" => "http://media0.giphy.com/media/Pvbwe3TghH6ko/giphy.gif",
|
46
|
+
"width" => "400",
|
47
|
+
"height" => "256",
|
48
|
+
"size" => "1477042",
|
49
|
+
"frames" => "21"
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
describe ".build_batch_from" do
|
56
|
+
it "creates a Giphy::Gif instance for each array element" do
|
57
|
+
array = [valid_hash, invalid_hash]
|
58
|
+
subject = Giphy::Gif.build_batch_from(array)
|
59
|
+
|
60
|
+
expect(subject.size).to eq array.size
|
61
|
+
|
62
|
+
subject.each do |special_gif|
|
63
|
+
expect(special_gif).to be_a Giphy::Gif
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "when iniatialized with a valid hash" do
|
69
|
+
subject { Giphy::Gif.new(valid_hash) }
|
70
|
+
|
71
|
+
its(:id) { should eq 'Pvbwe3TghH6ko' }
|
72
|
+
its(:url) { should eq URI('http://giphy.com/gifs/Pvbwe3TghH6ko') }
|
73
|
+
its(:bitly_gif_url) { should eq URI('http://gph.is/18MZ2ya') }
|
74
|
+
its(:bitly_fullscreen_url) { should eq URI('http://gph.is/18MZ2yc') }
|
75
|
+
its(:bitly_tiled_url) { should eq URI('http://gph.is/18MZ2ye') }
|
76
|
+
its(:embed_url) { should eq URI('http://giphy.com/embed/Pvbwe3TghH6ko') }
|
77
|
+
end
|
78
|
+
|
79
|
+
context "when initialized with an empty/invalid hash" do
|
80
|
+
subject { Giphy::Gif.new(invalid_hash) }
|
81
|
+
|
82
|
+
it { expect{ subject.id }.to raise_error KeyError }
|
83
|
+
its(:url) { should eq URI('') }
|
84
|
+
its(:bitly_gif_url) { should eq URI('') }
|
85
|
+
its(:bitly_fullscreen_url) { should eq URI('') }
|
86
|
+
its(:bitly_tiled_url) { should eq URI('') }
|
87
|
+
its(:embed_url) { should eq URI('') }
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Giphy::Image do
|
4
|
+
subject { Giphy::Image.new(hash) }
|
5
|
+
|
6
|
+
context "when initialized with a valid hash" do
|
7
|
+
let(:hash) do
|
8
|
+
{"url" => "http://media0.giphy.com/media/ygsIHxE5xSI4o/original.gif",
|
9
|
+
"width" => "400",
|
10
|
+
"height" => "292",
|
11
|
+
"size" => "1013326",
|
12
|
+
"frames" => "11"
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
its(:url) { should eq URI("http://media0.giphy.com/media/ygsIHxE5xSI4o/original.gif") }
|
17
|
+
its(:width) { should eq 400 }
|
18
|
+
its(:height) { should eq 292 }
|
19
|
+
its(:size) { should eq 1013326 }
|
20
|
+
its(:frames) { should eq 11 }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "when initialized with an empty/invalid hash" do
|
24
|
+
let(:hash) { {} }
|
25
|
+
|
26
|
+
it { expect{ subject.url }.to raise_error KeyError }
|
27
|
+
it { expect{ subject.width }.to raise_error KeyError }
|
28
|
+
it { expect{ subject.height }.to raise_error KeyError }
|
29
|
+
its(:size) { should eq 0 }
|
30
|
+
its(:frames) { should eq 0 }
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Giphy::Request do
|
4
|
+
let(:connection) { double('connection') }
|
5
|
+
let(:get_response) { double('get_response') }
|
6
|
+
let(:post_response) { double('post_response') }
|
7
|
+
|
8
|
+
before do
|
9
|
+
Faraday.stub(new: connection)
|
10
|
+
Giphy::Configuration.stub(api_key: 'dc6zaTOxFJmzC')
|
11
|
+
Giphy::Configuration.stub(version: 'v1')
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".get" do
|
15
|
+
it "creates an instance and sends #get to it" do
|
16
|
+
instance = double
|
17
|
+
Giphy::Request.stub(new: instance)
|
18
|
+
instance.stub(:get).with('/path', {}).and_return(get_response)
|
19
|
+
expect(Giphy::Request.get('/path', {})).to eq get_response
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe ".post" do
|
24
|
+
it "creates an instance and sends #post to it" do
|
25
|
+
instance = double
|
26
|
+
Giphy::Request.stub(new: instance)
|
27
|
+
instance.stub(:post).with('/path', {}).and_return(get_response)
|
28
|
+
expect(Giphy::Request.post('/path', {})).to eq get_response
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#get" do
|
33
|
+
it "returns the response of doing a get to an API endpoint" do
|
34
|
+
connection.stub(:get).
|
35
|
+
with('/v1/gifs/test', {api_key: 'dc6zaTOxFJmzC', option: 'option'}).
|
36
|
+
and_return(get_response)
|
37
|
+
expect(Giphy::Request.new.get('/test', option: 'option')).to eq get_response
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "#post" do
|
42
|
+
it "returns the response of doing a post to an API endpoint" do
|
43
|
+
connection.stub(:post).
|
44
|
+
with('/v1/gifs/test', {api_key: 'dc6zaTOxFJmzC', option: 'option'}).
|
45
|
+
and_return(post_response)
|
46
|
+
expect(Giphy::Request.new.post('/test', option: 'option')).to eq post_response
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Giphy::Response do
|
4
|
+
describe ".build" do
|
5
|
+
it "creates an instance and calls #data on it" do
|
6
|
+
data = double
|
7
|
+
response = double(data: data)
|
8
|
+
Giphy::Response.stub(new: response)
|
9
|
+
expect(Giphy::Response.build({})).to eq data
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#data" do
|
14
|
+
let(:response) { double(body: hash) }
|
15
|
+
subject { Giphy::Response.new(response) }
|
16
|
+
|
17
|
+
context "when response contains 'data'" do
|
18
|
+
let(:hash) { {'data' => 'data'} }
|
19
|
+
|
20
|
+
it "returns the 'data' value" do
|
21
|
+
expect(subject.data).to eq 'data'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "when response does not contain 'data'" do
|
26
|
+
let(:hash) do
|
27
|
+
{ 'meta' =>
|
28
|
+
{ 'error_type' => 403,
|
29
|
+
'code' => 403,
|
30
|
+
'error_message' => 'Forbidden'
|
31
|
+
}
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
it "raises an error and sets its message" do
|
36
|
+
expect{
|
37
|
+
subject.data
|
38
|
+
Giphy::Errors::API.should_receive(:new).with('403 Forbidden')
|
39
|
+
}.to raise_error Giphy::Errors::API
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Giphy::Search do
|
4
|
+
class TestObject ; include Giphy::Search ; end
|
5
|
+
|
6
|
+
subject { TestObject.new }
|
7
|
+
|
8
|
+
let(:client) { double('client') }
|
9
|
+
let(:client_result) { double('result') }
|
10
|
+
let(:response) { double('response') }
|
11
|
+
let(:options) { {option: 'option'} }
|
12
|
+
|
13
|
+
before { Giphy::Client.stub(new: client) }
|
14
|
+
|
15
|
+
describe "#recent" do
|
16
|
+
it "returns a batch of Gifs from the client result" do
|
17
|
+
client.stub(:recent).with(options).and_return(client_result)
|
18
|
+
Giphy::Gif.stub(:build_batch_from).with(client_result).and_return(response)
|
19
|
+
expect(subject.recent(options)).to eq response
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#translate" do
|
24
|
+
it "returns a batch of Gifs from the client result" do
|
25
|
+
client.stub(:translate).with('word').and_return(client_result)
|
26
|
+
Giphy::Gif.stub(:build_batch_from).with(client_result).and_return(response)
|
27
|
+
expect(subject.translate('word')).to eq response
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe "#search" do
|
32
|
+
it "returns a batch of Gifs from the client result" do
|
33
|
+
client.stub(:search).with('keyword', options).and_return(client_result)
|
34
|
+
Giphy::Gif.stub(:build_batch_from).with(client_result).and_return(response)
|
35
|
+
expect(subject.search('keyword', options)).to eq response
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#flag" do
|
40
|
+
it "returns a new FlaggedGif from the client result" do
|
41
|
+
client.stub(:flag).with('wdsf34df').and_return(client_result)
|
42
|
+
Giphy::FlaggedGif.stub(:new).with(client_result).and_return(response)
|
43
|
+
expect(subject.flag('wdsf34df')).to eq response
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "#flagged" do
|
48
|
+
it "returns a batch of FlaggedGifs from the client result" do
|
49
|
+
client.stub(flagged: client_result)
|
50
|
+
Giphy::FlaggedGif.stub(:build_batch_from).with(client_result).and_return(response)
|
51
|
+
expect(subject.flagged).to eq response
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "#favorite" do
|
56
|
+
it "returns a new FavoriteGifs from the client result" do
|
57
|
+
client.stub(:favorite).with('wdsf34df').and_return(client_result)
|
58
|
+
Giphy::FavoriteGif.stub(:new).with(client_result).and_return(response)
|
59
|
+
expect(subject.favorite('wdsf34df')).to eq response
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "#favorites" do
|
64
|
+
it "returns a batch of FavoriteGifs from the client result" do
|
65
|
+
client.stub(favorites: client_result)
|
66
|
+
Giphy::FavoriteGif.stub(:build_batch_from).with(client_result).and_return(response)
|
67
|
+
expect(subject.favorites).to eq response
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "#screensaver" do
|
72
|
+
it "returns a new Gif from the client result" do
|
73
|
+
client.stub(:screensaver).with('tag').and_return(client_result)
|
74
|
+
Giphy::Gif.stub(:new).with(client_result).and_return(response)
|
75
|
+
expect(subject.screensaver('tag')).to eq response
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "#random" do
|
80
|
+
it "returns a new Gif from the client result" do
|
81
|
+
client.stub(random: client_result)
|
82
|
+
Giphy::Gif.stub(:new).with(client_result).and_return(response)
|
83
|
+
expect(subject.random).to eq response
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe "#artists" do
|
88
|
+
it "returns a batch of Artists from the client result" do
|
89
|
+
client.stub(artists: client_result)
|
90
|
+
Giphy::Artist.stub(:build_batch_from).with(client_result).and_return(response)
|
91
|
+
expect(subject.artists).to eq response
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#gif_by_artist" do
|
96
|
+
it "returns a batch of Gifs from the client result" do
|
97
|
+
client.stub(:artists).with(username: 'artist_name', option: 'option').and_return(client_result)
|
98
|
+
Giphy::Gif.stub(:build_batch_from).with(client_result).and_return(response)
|
99
|
+
expect(subject.gif_by_artist('artist_name', options)).to eq response
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "#gif_by_id" do
|
104
|
+
it "returns a batch of Gifs from the client result" do
|
105
|
+
gif_by_id = double
|
106
|
+
Giphy::GifByID.stub(new: gif_by_id)
|
107
|
+
gif_by_id.stub(:get).with(['wdsf34df', 'ydfe779f']).and_return(response)
|
108
|
+
expect(subject.gif_by_id('wdsf34df', 'ydfe779f')).to eq response
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|