reviewed 0.6.4 → 0.7

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: 3cd30ef279c05f3f026964de3ac26daa0acdcada
4
- data.tar.gz: bb53799075c3ab77d965b01bdfbd9d6c01153cc8
3
+ metadata.gz: 0c792795b7c06ab995be841258051f4a3d69c028
4
+ data.tar.gz: 5e48c94469b90851737451bcb09055588c85fe7c
5
5
  SHA512:
6
- metadata.gz: f21d93faaa5d6b4215d05b4f58638ea123866c8e6ec2d910a57fd11561404bde791d8f39857276ca489009bf013af56d578e701e21b47f9dc878d686ed966838
7
- data.tar.gz: 1042ec623a5d69487eed6ff7094c56d74938d6394f74d43f831d3894c47c96c10282feeadd9efc0e4c7bc8567801106c446e7a0634034afab5ca5f3da0b66ea0
6
+ metadata.gz: 4e8d6bc0c79d1f678b1d8fddc46209562de5b3e4f95d99cc508231db3edbaee9795c39e4f2ba29418c255b719cd10896d68c57130155073fb7a0f3fe01bc4652
7
+ data.tar.gz: dad66fac14ece996338023c83369e14e25b3545118151b49a5d4ed4de5943f9c0c87b4f0d2b7466276be577a12d6fe6de35a1af5713545497f822a234ff19415
data/lib/faraday/cache.rb CHANGED
@@ -18,7 +18,7 @@ module Faraday
18
18
 
19
19
  if serve_from_cache? && store.exist?(cache_key)
20
20
  begin
21
- Hashie::Mash.new(Marshal.load( store.read(cache_key) ))
21
+ Hashie::Mash.new(MultiJson.load( store.read(cache_key) ))
22
22
  rescue => e
23
23
  raise e.message + ": #{cache_key}"
24
24
  end
@@ -26,7 +26,7 @@ module Faraday
26
26
  @app.call(env).on_complete do |response|
27
27
  if store_response?(response)
28
28
  store.delete(cache_key)
29
- store.write(cache_key, Marshal.dump(response), write_options)
29
+ store.write(cache_key, MultiJson.dump(response), write_options)
30
30
  end
31
31
  end
32
32
  end
@@ -1,4 +1,4 @@
1
1
  module Reviewed
2
- VERSION = "0.6.4"
2
+ VERSION = "0.7"
3
3
  API_VERSION = 'v1'
4
4
  end
data/lib/reviewed.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
2
2
 
3
+ require 'multi_json'
3
4
  require 'faraday'
4
5
  require 'faraday_middleware'
5
6
  require 'faraday/api_key'
data/reviewed.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency 'hashie', '~> 1.2'
23
23
  gem.add_dependency 'rack'
24
24
  gem.add_dependency 'redis-activesupport'
25
+ gem.add_dependency 'multi_json'
25
26
 
26
27
  gem.add_development_dependency 'rake'
27
28
  gem.add_development_dependency 'rspec', '>= 2.10'
@@ -17,15 +17,15 @@ describe Faraday::Cache do
17
17
  conn.headers = { "X-Reviewed-Website" => 'f0000123' }
18
18
 
19
19
  it "caches anything that doesn't have skip-cache or reset-cache" do
20
- mock_cache_val = mock
21
- Marshal.stub(:dump).with(hash_including(:body => 'I like turtles')).and_return(mock_cache_val)
20
+ mock_cache_val = double
21
+ MultiJson.stub(:dump).with(hash_including(:body => 'I like turtles')).and_return(mock_cache_val)
22
22
  Reviewed::Cache.store.should_receive(:write).with("f0000123:/articles", mock_cache_val, anything)
23
23
  conn.get('/articles')
24
24
  end
25
25
 
26
26
  it "can cache more than one thing" do
27
- mock_cache_val = mock
28
- Marshal.stub(:dump => mock_cache_val)
27
+ mock_cache_val = double
28
+ MultiJson.stub(:dump => mock_cache_val)
29
29
  Reviewed::Cache.store.should_receive(:write).with("f0000123:/articles", mock_cache_val, anything)
30
30
  Reviewed::Cache.store.should_receive(:write).with("f0000123:/products", mock_cache_val, anything)
31
31
 
@@ -34,7 +34,7 @@ describe Faraday::Cache do
34
34
  end
35
35
 
36
36
  it "serves responses from the cache when fresh and does not call the app" do
37
- marshalled_response = Marshal.dump(body: 'old musty response')
37
+ marshalled_response = MultiJson.dump(body: 'old musty response')
38
38
  Reviewed::Cache.store.stub(:exist? => true)
39
39
  Reviewed::Cache.store.should_receive(:read).with("f0000123:/articles").and_return(marshalled_response)
40
40
  resp = conn.get '/articles'
@@ -54,6 +54,8 @@ describe Faraday::Cache do
54
54
  end
55
55
 
56
56
  it "replaces cached content with app response when reset-cache is a query param" do
57
+ mock_cache_val = double
58
+ MultiJson.stub(:dump).and_return(mock_cache_val)
57
59
  Reviewed::Cache.store.should_not_receive(:read)
58
60
  Reviewed::Cache.store.should_receive(:write)
59
61
  conn.get '/articles', {:"reset-cache" => true}
@@ -37,7 +37,7 @@ describe Faraday::Errors do
37
37
 
38
38
  it 'raises an ApiError error' do
39
39
  client = Reviewed::Client.new
40
- client.stub!(:connection).and_return(test2)
40
+ client.stub(:connection).and_return(test2)
41
41
  expect {
42
42
  client.send(:perform, :get, '/products/123')
43
43
  }.to raise_error(Reviewed::ApiError)
@@ -45,7 +45,7 @@ describe Faraday::Errors do
45
45
 
46
46
  it 'passes other Reviewed errors through' do
47
47
  client = Reviewed::Client.new
48
- client.stub!(:connection).and_raise(Reviewed::ConfigurationError.new)
48
+ client.stub(:connection).and_raise(Reviewed::ConfigurationError.new)
49
49
  expect {
50
50
  client.send(:perform, :get, '/products/123')
51
51
  }.to raise_error(Reviewed::ConfigurationError)
data/spec/request_spec.rb CHANGED
@@ -32,7 +32,7 @@ describe Reviewed::Request do
32
32
  end
33
33
 
34
34
  it 'with resource as an object, calls :to_path on it' do
35
- article_class = mock
35
+ article_class = double
36
36
  article_class.should_receive(:to_path).and_return('article')
37
37
  request = Reviewed::Request.new(resource: article_class)
38
38
  request.path.should eql('article')
@@ -41,8 +41,8 @@ describe Reviewed::Request do
41
41
 
42
42
  context 'scoped resource' do
43
43
  it 'calls to path with the given scope param' do
44
- article_class = mock
45
- scope = mock
44
+ article_class = double
45
+ scope = double
46
46
  article_class.should_receive(:to_path).with(scope)
47
47
  request = Reviewed::Request.new(resource: article_class, scope: scope)
48
48
  request.path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reviewed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: '0.7'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Plante
@@ -109,6 +109,20 @@ dependencies:
109
109
  - - '>='
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: multi_json
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
112
126
  - !ruby/object:Gem::Dependency
113
127
  name: rake
114
128
  requirement: !ruby/object:Gem::Requirement