giphy 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd309051cea1c13dfa8ed22b5a2f200d6d7d8446
4
- data.tar.gz: e1425d1073873285c07ea700b8541f343d7dd489
3
+ metadata.gz: d3c7554e8f3aa5b3d2b541f954b2907a94cbe9ad
4
+ data.tar.gz: afd130adf6262c5a74e7313bd8da190a5db606cf
5
5
  SHA512:
6
- metadata.gz: c9e7d244fb4b78e0de931a24a10c3bc0c6dd561eab86e0e999ca240e16b80e09aec3ab3afaa0f7ed5227bdd96aad1daeb126fb2455ecce70d7314ca2ab6d04c3
7
- data.tar.gz: 5cd2d7d65f0c17dbae0321ca535dd52fbdefc31feee0ac988e87606314360647a80c2af497e64c0027c90a25c739232a6ce667fea4de7de4a08ab49b1643c0d0
6
+ metadata.gz: b31939e10d260c2132a180060b376a04488dabd63b3259acae67e24b57caad625f1698b2e6507a16be032655b614fae30dce3d077f73e03e5397beb3e9ffbfe8
7
+ data.tar.gz: 4f166904151417744cccfcb519868b9e43fe278689e99ff6ff8011010bf531db1f190a057fb26fed690bad57ec72021e9c01a3c9813319bc8a89516f491bda02
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Code Climate](https://codeclimate.com/github/sebasoga/giphy.png)](https://codeclimate.com/github/sebasoga/giphy)
5
5
 
6
6
  Because GIFs make life fun! Use [Giphy API](http://api.giphy.com) from your Ruby programs and
7
- command line. Check out [Giphy Labs](http://labs.giphy.com/) for inspiration.
7
+ command line. Check out [Giphy Labs](http://labs.giphy.com/) for inspiration.
8
8
 
9
9
  ![](http://media.giphy.com/media/GuDQNjS0qJHpe/200.gif)
10
10
 
@@ -39,9 +39,9 @@ to specific values the default values for the beta period will be used. Check
39
39
 
40
40
  That's it, you're ready to have fun!
41
41
 
42
- #### Recent
42
+ #### Trending
43
43
  ````ruby
44
- Giphy.recent(tag: 'cats', limit: 5)
44
+ Giphy.trending(limit: 5)
45
45
  ````
46
46
 
47
47
  #### Translate
@@ -21,7 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake", "~> 10.1"
23
23
  spec.add_development_dependency "rspec", "~> 2.14"
24
- spec.add_dependency "faraday", "~> 0.8.8"
25
- spec.add_dependency "faraday_middleware-parse_oj", "~> 0.2.1"
26
- spec.add_dependency "launchy", "~> 2.4.2"
24
+ spec.add_development_dependency "rspec-its", "~> 1.0"
25
+ spec.add_dependency "faraday", "~> 0.9"
26
+ spec.add_dependency "faraday_middleware-parse_oj", "~> 0.3"
27
+ spec.add_dependency "launchy", "~> 2.4"
27
28
  end
@@ -1,7 +1,7 @@
1
1
  module Giphy
2
2
  class Client
3
- def recent(options={})
4
- get('/recent', options)
3
+ def trending(options={})
4
+ get('/trending', options)
5
5
  end
6
6
 
7
7
  def translate(word)
@@ -15,7 +15,7 @@ module Giphy
15
15
 
16
16
  def flag(id)
17
17
  post("/#{id}/flagged")
18
- end
18
+ end
19
19
 
20
20
  def flagged
21
21
  get('/flagged')
@@ -4,6 +4,7 @@ require 'giphy/special_gif'
4
4
  module Giphy
5
5
  class FlaggedGif < Giphy::SpecialGif
6
6
  def inappropriate?
7
+ puts hash.fetch('is_inappropriate')
7
8
  hash.fetch('is_inappropriate') == "1"
8
9
  end
9
10
 
@@ -1,3 +1,3 @@
1
1
  module Giphy
2
- VERSION = "1.2.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -5,8 +5,8 @@ describe Giphy::CLI do
5
5
  describe ".run" do
6
6
  it "creates a new instance and sends 'run'" do
7
7
  instance = double
8
- Giphy::CLI.stub(:new).with('keyword').and_return(instance)
9
- instance.stub(search: 'shell command')
8
+ allow(Giphy::CLI).to receive(:new).with('keyword').and_return(instance)
9
+ allow(instance).to receive(:search).and_return('shell command')
10
10
  expect(Giphy::CLI.run('keyword')).to eq 'shell command'
11
11
  end
12
12
  end
@@ -15,7 +15,11 @@ describe Giphy::CLI do
15
15
  subject { Giphy::CLI.new('horse') }
16
16
 
17
17
  context "when a gif is found" do
18
- before { Giphy.stub(screensaver: double(id: 'OoFJ7iMGUBpiE')) }
18
+ before do
19
+ allow(Giphy).
20
+ to receive(:screensaver).
21
+ and_return(double(id: 'OoFJ7iMGUBpiE'))
22
+ end
19
23
 
20
24
  it "echoes a message to the console and opens the url using Kernel#system" do
21
25
  expect(subject).
@@ -32,10 +36,10 @@ describe Giphy::CLI do
32
36
  end
33
37
 
34
38
  context "when a Giphy::Errors:API error is raised" do
35
- before { Giphy.stub(:screensaver).and_raise(Giphy::Errors::API) }
39
+ before { allow(Giphy).to receive(:screensaver).and_raise(Giphy::Errors::API) }
36
40
 
37
41
  it "echoes a message to the console and opens the url using Kernel#system" do
38
- subject.should_receive(:system).
42
+ expect(subject).to receive(:system).
39
43
  with("echo 'Showing the GIF on your browser'")
40
44
  subject.search
41
45
  end
@@ -4,48 +4,71 @@ describe Giphy::Client do
4
4
  let(:api_response) { double }
5
5
  let(:response) { double }
6
6
 
7
- before { Giphy::Response.stub(:build).with(api_response).and_return(response) }
7
+ before do
8
+ allow(Giphy::Response).
9
+ to receive(:build).
10
+ with(api_response).
11
+ and_return(response)
12
+ end
8
13
 
9
14
  subject { Giphy::Client.new }
10
15
 
11
- describe "#recent" do
12
- it "does a GET on the 'recent' endpoint" do
13
- Giphy::Request.stub(:get).with('/recent', options: 'options').and_return(api_response)
14
- expect(subject.recent(options: 'options')).to eq response
16
+ describe "#trending" do
17
+ it "does a GET on the 'trending' endpoint" do
18
+ allow(Giphy::Request).
19
+ to receive(:get).
20
+ with('/trending', options: 'options').
21
+ and_return(api_response)
22
+ expect(subject.trending(options: 'options')).to eq response
15
23
  end
16
24
  end
17
25
 
18
26
  describe "#translate" do
19
27
  it "does a GET on the 'transalate' endpoint" do
20
- Giphy::Request.stub(:get).with('/translate', s: 'word').and_return(api_response)
28
+ allow(Giphy::Request).
29
+ to receive(:get).
30
+ with('/translate', s: 'word').
31
+ and_return(api_response)
21
32
  expect(subject.translate('word')).to eq response
22
33
  end
23
34
  end
24
35
 
25
36
  describe "#search" do
26
37
  it "does a GET on the 'search' endpoint" do
27
- Giphy::Request.stub(:get).with('/search', {q: 'keyword', options: 'options'}).and_return(api_response)
38
+ allow(Giphy::Request).
39
+ to receive(:get).
40
+ with('/search', {q: 'keyword', options: 'options'}).
41
+ and_return(api_response)
28
42
  expect(subject.search('keyword', options: 'options')).to eq response
29
43
  end
30
44
  end
31
45
 
32
46
  describe "#flag" do
33
47
  it "does a POST on the 'flagged' endpoint" do
34
- Giphy::Request.stub(:post).with('/12HoHdqnDxz5NS/flagged', {}).and_return(api_response)
48
+ allow(Giphy::Request).
49
+ to receive(:post).
50
+ with('/12HoHdqnDxz5NS/flagged', {}).
51
+ and_return(api_response)
35
52
  expect(subject.flag('12HoHdqnDxz5NS')).to eq response
36
53
  end
37
54
  end
38
55
 
39
56
  describe "#flagged" do
40
57
  it "does a GET on the 'flagged' endpoint" do
41
- Giphy::Request.stub(:get).with('/flagged', {}).and_return(api_response)
58
+ allow(Giphy::Request).
59
+ to receive(:get).
60
+ with('/flagged', {}).
61
+ and_return(api_response)
42
62
  expect(subject.flagged).to eq response
43
63
  end
44
64
  end
45
65
 
46
66
  describe "#favorite" do
47
67
  it "does a POST on the 'favorites' endpoint" do
48
- Giphy::Request.stub(:post).with('/12HoHdqnDxz5NS/favorites', {}).and_return(api_response)
68
+ allow(Giphy::Request).
69
+ to receive(:post).
70
+ with('/12HoHdqnDxz5NS/favorites', {}).
71
+ and_return(api_response)
49
72
  expect(subject.favorite('12HoHdqnDxz5NS')).to eq response
50
73
  end
51
74
  end
@@ -53,7 +76,10 @@ describe Giphy::Client do
53
76
  describe "#favorites" do
54
77
  context "when no username is passed to it" do
55
78
  it "does a GET on the 'favorites' endpoint with no username" do
56
- Giphy::Request.stub(:get).with('/favorites', {username: ''}).and_return(api_response)
79
+ allow(Giphy::Request).
80
+ to receive(:get).
81
+ with('/favorites', {username: ''}).
82
+ and_return(api_response)
57
83
  expect(subject.favorites).to eq response
58
84
  end
59
85
  end
@@ -61,7 +87,10 @@ describe Giphy::Client do
61
87
  context "when a username is passed as an argument" do
62
88
  it "does a GET on the 'favorites' endpoint with the username" do
63
89
  username = 'absurdnoise'
64
- Giphy::Request.stub(:get).with('/favorites', {username: username}).and_return(api_response)
90
+ allow(Giphy::Request).
91
+ to receive(:get).
92
+ with('/favorites', {username: username}).
93
+ and_return(api_response)
65
94
  expect(subject.favorites(username)).to eq response
66
95
  end
67
96
  end
@@ -69,7 +98,10 @@ describe Giphy::Client do
69
98
 
70
99
  describe "#screensaver" do
71
100
  it "does a GET on the 'screensaver' endpoint" do
72
- Giphy::Request.stub(:get).with('/screensaver', {tag: 'tag'}).and_return(api_response)
101
+ allow(Giphy::Request).
102
+ to receive(:get).
103
+ with('/screensaver', {tag: 'tag'}).
104
+ and_return(api_response)
73
105
  expect(subject.screensaver('tag')).to eq response
74
106
  end
75
107
  end
@@ -77,14 +109,19 @@ describe Giphy::Client do
77
109
  describe "#random" do
78
110
  context "when no tag is passed to it" do
79
111
  it "does a GET on the 'random' endpoint with no tag" do
80
- Giphy::Request.stub(:get).with('/random', {tag: ''}).and_return(api_response)
112
+ allow(Giphy::Request).to receive(:get).
113
+ with('/random', {tag: ''}).
114
+ and_return(api_response)
81
115
  expect(subject.random).to eq response
82
116
  end
83
117
  end
84
118
 
85
119
  context "when a tag is passed to it" do
86
120
  it "does a GET on the 'random' endpoint with a tag" do
87
- Giphy::Request.stub(:get).with('/random', {tag: 'american psycho'}).and_return(api_response)
121
+ expect(Giphy::Request).
122
+ to receive(:get).
123
+ with('/random', {tag: 'american psycho'}).
124
+ and_return(api_response)
88
125
  expect(subject.random('american psycho')).to eq response
89
126
  end
90
127
  end
@@ -92,21 +129,30 @@ describe Giphy::Client do
92
129
 
93
130
  describe "#artists" do
94
131
  it "does a GET on the 'artists' endpoint" do
95
- Giphy::Request.stub(:get).with('/artists', {}).and_return(api_response)
132
+ allow(Giphy::Request).
133
+ to receive(:get).
134
+ with('/artists', {}).
135
+ and_return(api_response)
96
136
  expect(subject.artists).to eq response
97
137
  end
98
138
  end
99
139
 
100
140
  describe "#gif" do
101
141
  it "does a GET on the 'gif_by_id' endpoint" do
102
- Giphy::Request.stub(:get).with('/12HoHdqnDxz5NS', {}).and_return(api_response)
142
+ allow(Giphy::Request).
143
+ to receive(:get).
144
+ with('/12HoHdqnDxz5NS', {}).
145
+ and_return(api_response)
103
146
  expect(subject.gif('12HoHdqnDxz5NS')).to eq response
104
147
  end
105
148
  end
106
149
 
107
150
  describe "#gifs" do
108
151
  it "does a GET on the 'artists' endpoint" do
109
- Giphy::Request.stub(:get).with('', {ids: '12HoHdqnDxz5NS,dc6zaTOxFJmzC'}).and_return(api_response)
152
+ allow(Giphy::Request).
153
+ to receive(:get).
154
+ with('', {ids: '12HoHdqnDxz5NS,dc6zaTOxFJmzC'}).
155
+ and_return(api_response)
110
156
  expect(subject.gifs(['12HoHdqnDxz5NS', 'dc6zaTOxFJmzC'])).to eq response
111
157
  end
112
158
  end
@@ -19,8 +19,8 @@ describe Giphy::FlaggedGif do
19
19
  context "when initialized with a valid hash" do
20
20
  subject { Giphy::FlaggedGif.new(valid_hash) }
21
21
 
22
- its(:inappropriate?) { should be_false }
23
- its(:wrong_source?) { should be_true }
22
+ its(:inappropriate?) { should be_falsy }
23
+ its(:wrong_source?) { should be_truthy }
24
24
  its(:source_corrected) { should eq "" }
25
25
  end
26
26
 
@@ -9,18 +9,18 @@ describe Giphy::GifByID do
9
9
  let(:client) { double(gif: gif_hash, gifs: [gif_hash, gif_hash]) }
10
10
 
11
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])
12
+ allow(Giphy::Client).to receive(:new).and_return(client)
13
+ allow(Giphy::Gif).to receive(:new).with(gif_hash).and_return(gif_object)
14
+ allow(Giphy::Gif).
15
+ to receive(:build_batch_from).
16
+ with([gif_hash, gif_hash]).
17
+ and_return([gif_object, gif_object])
15
18
  end
16
19
 
17
20
  describe "#get" do
18
21
  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
22
+ it "raises an ArgumentError" do
23
+ expect{ subject.get([]) }.to raise_error Giphy::Errors::ArgumentError
24
24
  end
25
25
  end
26
26
 
@@ -6,16 +6,16 @@ describe Giphy::Request do
6
6
  let(:post_response) { double('post_response') }
7
7
 
8
8
  before do
9
- Faraday.stub(new: connection)
10
- Giphy::Configuration.stub(api_key: 'dc6zaTOxFJmzC')
11
- Giphy::Configuration.stub(version: 'v1')
9
+ allow(Faraday).to receive(:new).and_return(connection)
10
+ allow(Giphy::Configuration).to receive(:api_key).and_return('dc6zaTOxFJmzC')
11
+ allow(Giphy::Configuration).to receive(:version).and_return('v1')
12
12
  end
13
13
 
14
14
  describe ".get" do
15
15
  it "creates an instance and sends #get to it" do
16
16
  instance = double
17
- Giphy::Request.stub(new: instance)
18
- instance.stub(:get).with('/path', {}).and_return(get_response)
17
+ allow(Giphy::Request).to receive(:new).and_return(instance)
18
+ allow(instance).to receive(:get).with('/path', {}).and_return(get_response)
19
19
  expect(Giphy::Request.get('/path', {})).to eq get_response
20
20
  end
21
21
  end
@@ -23,15 +23,16 @@ describe Giphy::Request do
23
23
  describe ".post" do
24
24
  it "creates an instance and sends #post to it" do
25
25
  instance = double
26
- Giphy::Request.stub(new: instance)
27
- instance.stub(:post).with('/path', {}).and_return(get_response)
26
+ allow(Giphy::Request).to receive(:new).and_return(instance)
27
+ allow(instance).to receive(:post).with('/path', {}).and_return(get_response)
28
28
  expect(Giphy::Request.post('/path', {})).to eq get_response
29
29
  end
30
30
  end
31
31
 
32
32
  describe "#get" do
33
33
  it "returns the response of doing a get to an API endpoint" do
34
- connection.stub(:get).
34
+ allow(connection).
35
+ to receive(:get).
35
36
  with('/v1/gifs/test', {api_key: 'dc6zaTOxFJmzC', option: 'option'}).
36
37
  and_return(get_response)
37
38
  expect(Giphy::Request.new.get('/test', option: 'option')).to eq get_response
@@ -40,7 +41,8 @@ describe Giphy::Request do
40
41
 
41
42
  describe "#post" do
42
43
  it "returns the response of doing a post to an API endpoint" do
43
- connection.stub(:post).
44
+ allow(connection).
45
+ to receive(:post).
44
46
  with('/v1/gifs/test', {api_key: 'dc6zaTOxFJmzC', option: 'option'}).
45
47
  and_return(post_response)
46
48
  expect(Giphy::Request.new.post('/test', option: 'option')).to eq post_response
@@ -5,7 +5,7 @@ describe Giphy::Response do
5
5
  it "creates an instance and calls #data on it" do
6
6
  data = double
7
7
  response = double(data: data)
8
- Giphy::Response.stub(new: response)
8
+ allow(Giphy::Response).to receive(:new).and_return(response)
9
9
  expect(Giphy::Response.build({})).to eq data
10
10
  end
11
11
  end
@@ -33,10 +33,7 @@ describe Giphy::Response do
33
33
  end
34
34
 
35
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
36
+ expect{ subject.data }.to raise_error Giphy::Errors::API
40
37
  end
41
38
  end
42
39
  end
@@ -10,52 +10,52 @@ describe Giphy::Search do
10
10
  let(:response) { double('response') }
11
11
  let(:options) { {option: 'option'} }
12
12
 
13
- before { Giphy::Client.stub(new: client) }
13
+ before { allow(Giphy::Client).to receive(:new).and_return(client) }
14
14
 
15
15
  describe "#recent" do
16
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)
17
+ allow(client).to receive(:recent).with(options).and_return(client_result)
18
+ allow(Giphy::Gif).to receive(:build_batch_from).with(client_result).and_return(response)
19
19
  expect(subject.recent(options)).to eq response
20
20
  end
21
21
  end
22
22
 
23
23
  describe "#translate" do
24
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)
25
+ allow(client).to receive(:translate).with('word').and_return(client_result)
26
+ allow(Giphy::Gif).to receive(:build_batch_from).with(client_result).and_return(response)
27
27
  expect(subject.translate('word')).to eq response
28
28
  end
29
29
  end
30
30
 
31
31
  describe "#search" do
32
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)
33
+ allow(client).to receive(:search).with('keyword', options).and_return(client_result)
34
+ allow(Giphy::Gif).to receive(:build_batch_from).with(client_result).and_return(response)
35
35
  expect(subject.search('keyword', options)).to eq response
36
36
  end
37
37
  end
38
38
 
39
39
  describe "#flag" do
40
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)
41
+ allow(client).to receive(:flag).with('wdsf34df').and_return(client_result)
42
+ allow(Giphy::FlaggedGif).to receive(:new).with(client_result).and_return(response)
43
43
  expect(subject.flag('wdsf34df')).to eq response
44
44
  end
45
45
  end
46
46
 
47
47
  describe "#flagged" do
48
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)
49
+ allow(client).to receive(:flagged).and_return(client_result)
50
+ allow(Giphy::FlaggedGif).to receive(:build_batch_from).with(client_result).and_return(response)
51
51
  expect(subject.flagged).to eq response
52
52
  end
53
53
  end
54
54
 
55
55
  describe "#favorite" do
56
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)
57
+ allow(client).to receive(:favorite).with('wdsf34df').and_return(client_result)
58
+ allow(Giphy::FavoriteGif).to receive(:new).with(client_result).and_return(response)
59
59
  expect(subject.favorite('wdsf34df')).to eq response
60
60
  end
61
61
  end
@@ -63,16 +63,16 @@ describe Giphy::Search do
63
63
  describe "#favorites" do
64
64
  it "returns a batch of FavoriteGifs from the client result" do
65
65
  username = 'absurdnoise'
66
- client.stub(:favorites).with(username, options).and_return(client_result)
67
- Giphy::FavoriteGif.stub(:build_batch_from).with(client_result).and_return(response)
66
+ allow(client).to receive(:favorites).with(username, options).and_return(client_result)
67
+ allow(Giphy::FavoriteGif).to receive(:build_batch_from).with(client_result).and_return(response)
68
68
  expect(subject.favorites(username, options)).to eq response
69
69
  end
70
70
  end
71
71
 
72
72
  describe "#screensaver" do
73
73
  it "returns a new Gif from the client result" do
74
- client.stub(:screensaver).with('tag').and_return(client_result)
75
- Giphy::Gif.stub(:new).with(client_result).and_return(response)
74
+ allow(client).to receive(:screensaver).with('tag').and_return(client_result)
75
+ allow(Giphy::Gif).to receive(:new).with(client_result).and_return(response)
76
76
  expect(subject.screensaver('tag')).to eq response
77
77
  end
78
78
  end
@@ -80,16 +80,16 @@ describe Giphy::Search do
80
80
  describe "#random" do
81
81
  context "when no tag is passed to it" do
82
82
  it "returns a new Gif from the client result" do
83
- client.stub(random: client_result)
84
- Giphy::RandomGif.stub(:new).with(client_result).and_return(response)
83
+ allow(client).to receive(:random).and_return(client_result)
84
+ allow(Giphy::RandomGif).to receive(:new).with(client_result).and_return(response)
85
85
  expect(subject.random).to eq response
86
86
  end
87
87
  end
88
88
 
89
89
  context "when a tag is passed to it" do
90
90
  it "returns a new Gif from the client result" do
91
- client.stub(:random).with('american psycho').and_return(client_result)
92
- Giphy::RandomGif.stub(:new).with(client_result).and_return(response)
91
+ allow(client).to receive(:random).with('american psycho').and_return(client_result)
92
+ allow(Giphy::RandomGif).to receive(:new).with(client_result).and_return(response)
93
93
  expect(subject.random('american psycho')).to eq response
94
94
  end
95
95
  end
@@ -97,16 +97,19 @@ describe Giphy::Search do
97
97
 
98
98
  describe "#artists" do
99
99
  it "returns a batch of Artists from the client result" do
100
- client.stub(artists: client_result)
101
- Giphy::Artist.stub(:build_batch_from).with(client_result).and_return(response)
100
+ allow(client).to receive(:artists).and_return(client_result)
101
+ allow(Giphy::Artist).to receive(:build_batch_from).with(client_result).and_return(response)
102
102
  expect(subject.artists).to eq response
103
103
  end
104
104
  end
105
105
 
106
106
  describe "#gif_by_artist" do
107
107
  it "returns a batch of Gifs from the client result" do
108
- client.stub(:artists).with(username: 'artist_name', option: 'option').and_return(client_result)
109
- Giphy::Gif.stub(:build_batch_from).with(client_result).and_return(response)
108
+ allow(client).
109
+ to receive(:artists).
110
+ with(username: 'artist_name', option: 'option').
111
+ and_return(client_result)
112
+ allow(Giphy::Gif).to receive(:build_batch_from).with(client_result).and_return(response)
110
113
  expect(subject.gif_by_artist('artist_name', options)).to eq response
111
114
  end
112
115
  end
@@ -114,8 +117,8 @@ describe Giphy::Search do
114
117
  describe "#gif_by_id" do
115
118
  it "returns a batch of Gifs from the client result" do
116
119
  gif_by_id = double
117
- Giphy::GifByID.stub(new: gif_by_id)
118
- gif_by_id.stub(:get).with(['wdsf34df', 'ydfe779f']).and_return(response)
120
+ allow(Giphy::GifByID).to receive(:new).and_return(gif_by_id)
121
+ allow(gif_by_id).to receive(:get).with(['wdsf34df', 'ydfe779f']).and_return(response)
119
122
  expect(subject.gif_by_id('wdsf34df', 'ydfe779f')).to eq response
120
123
  end
121
124
  end
@@ -1,6 +1,7 @@
1
1
  ENV["env"] ||= "test"
2
2
 
3
3
  require 'giphy'
4
+ require 'rspec/its'
4
5
 
5
6
  Dir["./spec/fixtures/*.rb"].each { |f| require f }
6
- Dir["./spec/shared_examples/*.rb"].each { |f| require f }
7
+ Dir["./spec/shared_examples/*.rb"].each { |f| require f }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: giphy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Sogamoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-02 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,48 +52,62 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.14'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-its
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: faraday
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: 0.8.8
75
+ version: '0.9'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: 0.8.8
82
+ version: '0.9'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: faraday_middleware-parse_oj
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: 0.2.1
89
+ version: '0.3'
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: 0.2.1
96
+ version: '0.3'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: launchy
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: 2.4.2
103
+ version: '2.4'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: 2.4.2
110
+ version: '2.4'
97
111
  description: A Ruby interface to the Giphy API.
98
112
  email:
99
113
  - sebasoga@gmail.com
@@ -146,7 +160,7 @@ files:
146
160
  - spec/giphy/response_spec.rb
147
161
  - spec/giphy/search_spec.rb
148
162
  - spec/giphy/special_gif_spec.rb
149
- - spec/shared_examples/special_gif_contract_spec.rb
163
+ - spec/shared_examples/special_gif_contract.rb
150
164
  - spec/spec_helper.rb
151
165
  homepage: http://github.com/sebasoga/giphy
152
166
  licenses:
@@ -168,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
182
  version: '0'
169
183
  requirements: []
170
184
  rubyforge_project:
171
- rubygems_version: 2.2.2
185
+ rubygems_version: 2.4.5
172
186
  signing_key:
173
187
  specification_version: 4
174
188
  summary: Enjoy Giphy API from you Ruby programs and command line
@@ -189,6 +203,5 @@ test_files:
189
203
  - spec/giphy/response_spec.rb
190
204
  - spec/giphy/search_spec.rb
191
205
  - spec/giphy/special_gif_spec.rb
192
- - spec/shared_examples/special_gif_contract_spec.rb
206
+ - spec/shared_examples/special_gif_contract.rb
193
207
  - spec/spec_helper.rb
194
- has_rdoc: