sawyer 0.6.0 → 0.7.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: 80567e1f99aebed1ceebd9a780b762ccec70f131
4
- data.tar.gz: 5d655e43363373e8c43a3ec736b51273509e0576
3
+ metadata.gz: 7366e3f2256e74947a4fa2774a611576e071df0c
4
+ data.tar.gz: 169092ebe870be47b615ae6256c4573c3c044f34
5
5
  SHA512:
6
- metadata.gz: 23547dec9018b054060a2580548b5c0b0df4bc9564dd7191d4d60ff11263464aa77ca83ea432dc4c8185ded9a5b4837e253d7b23518de093925b6cfd3d5bb17d
7
- data.tar.gz: 83341503aa9ece0200d92a8b75e028f7cfff4c93ca66ea852857d58b0f2312f4da5df5353910c0323cbf1b6a8fbebd78fde7356bf34200f80b95a1c3ab1c4e6b
6
+ metadata.gz: 0b454b751c638a4a33b81dd9f1cd5aae1e981af61f7be32133ef2defb0a750c224eee75164701e511c33e478563a9d66986a01e9344902f2c6e602cbec35ed47
7
+ data.tar.gz: a1c2cda9e4507367c1b90126cae91c2b6ed0a0e5d6eb130587ee7c1f301609118d37b9578c1722ead9a50e4058a02f568120aab71ca076554a75afd353276e4b
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
  gem 'rake'
5
+
6
+ group :test do
7
+ gem "minitest"
8
+ end
@@ -1,5 +1,5 @@
1
1
  module Sawyer
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
 
4
4
  class Error < StandardError; end
5
5
  end
@@ -3,8 +3,6 @@ module Sawyer
3
3
  SPECIAL_METHODS = Set.new(%w(agent rels fields))
4
4
  attr_reader :_agent, :_rels, :_fields
5
5
  attr_reader :attrs
6
- alias to_hash attrs
7
- alias to_h attrs
8
6
  include Enumerable
9
7
 
10
8
  # Initializes a Resource with the given data.
@@ -142,6 +140,9 @@ module Sawyer
142
140
  hash
143
141
  end
144
142
 
143
+ alias to_hash to_attrs
144
+ alias to_h to_attrs
145
+
145
146
  def marshal_dump
146
147
  [@attrs, @_fields, @_rels]
147
148
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.licenses = ['MIT']
19
19
 
20
20
  spec.add_dependency 'faraday', ['~> 0.8', '< 0.10']
21
- spec.add_dependency 'addressable', ['~> 2.3.5']
21
+ spec.add_dependency 'addressable', ['>= 2.3.5', '< 2.5']
22
22
 
23
23
  spec.files = %w(Gemfile LICENSE.md README.md Rakefile)
24
24
  spec.files << "#{lib}.gemspec"
@@ -68,7 +68,7 @@ module Sawyer
68
68
  end
69
69
 
70
70
  assert_kind_of Sawyer::Response, @agent.root
71
- assert_not_equal @agent.root.time, @agent.start.time
71
+ refute_equal @agent.root.time, @agent.start.time
72
72
  end
73
73
 
74
74
  def test_starts_a_session
@@ -169,18 +169,14 @@ module Sawyer
169
169
  end
170
170
 
171
171
  def test_handle_yaml_dump_and_load
172
- assert_nothing_raised do
173
- require 'yaml'
174
- res = Agent.new 'http://example.com', :a => 1
175
- YAML.load(YAML.dump(res))
176
- end
172
+ require 'yaml'
173
+ res = Agent.new 'http://example.com', :a => 1
174
+ YAML.load(YAML.dump(res))
177
175
  end
178
176
 
179
177
  def test_handle_marshal_dump_and_load
180
- assert_nothing_raised do
181
- res = Agent.new 'http://example.com', :a => 1
182
- Marshal.load(Marshal.dump(res))
183
- end
178
+ res = Agent.new 'http://example.com', :a => 1
179
+ Marshal.load(Marshal.dump(res))
184
180
  end
185
181
 
186
182
  def test_blank_response_doesnt_raise
@@ -193,9 +189,7 @@ module Sawyer
193
189
  conn.adapter :test, @stubs
194
190
  end
195
191
 
196
- assert_nothing_raised do
197
- assert_equal 200, agent.root.status
198
- end
192
+ assert_equal 200, agent.root.status
199
193
  end
200
194
  end
201
195
  end
@@ -1,7 +1,7 @@
1
- require 'test/unit'
1
+ require "minitest/autorun"
2
2
  require File.expand_path('../../lib/sawyer', __FILE__)
3
3
 
4
- class Sawyer::TestCase < Test::Unit::TestCase
4
+ class Sawyer::TestCase < Minitest::Test
5
5
  def default_test
6
6
  end
7
7
  end
@@ -168,7 +168,7 @@ module Sawyer
168
168
  rel = Sawyer::Relation.from_link(nil, :self, hash)
169
169
  map << rel
170
170
 
171
- assert_equal "{:self_url=>\"/users/1\"}\n", map.inspect
171
+ assert_equal "{:self_url=>\"/users/1\"}", map.inspect
172
172
  end
173
173
  end
174
174
  end
@@ -99,9 +99,7 @@ module Sawyer
99
99
  assert !res.respond_to?(:b)
100
100
  assert !res.respond_to?(:b=)
101
101
  assert_nil res.b
102
- assert_nothing_raised do
103
- res.b
104
- end
102
+ res.b
105
103
  end
106
104
 
107
105
  def test_dynamic_attribute_methods_from_setter
@@ -128,6 +126,12 @@ module Sawyer
128
126
  assert_equal hash, res.to_h
129
127
  end
130
128
 
129
+ def test_to_h_with_nesting
130
+ res = Resource.new @agent, :a => {:b => 1}
131
+ hash = {:a => {:b => 1}}
132
+ assert_equal hash, res.to_h
133
+ end
134
+
131
135
  def test_to_attrs_for_sawyer_resource_arrays
132
136
  res = Resource.new @agent, :a => 1, :b => [Resource.new(@agent, :a => 2)]
133
137
  hash = {:a => 1, :b => [{:a => 2}]}
@@ -163,24 +167,20 @@ module Sawyer
163
167
  end
164
168
 
165
169
  def test_handle_yaml_dump
166
- assert_nothing_raised do
167
- require 'yaml'
168
- res = Resource.new @agent, :a => 1
169
- YAML.dump(res)
170
- end
170
+ require 'yaml'
171
+ res = Resource.new @agent, :a => 1
172
+ YAML.dump(res)
171
173
  end
172
174
 
173
175
  def test_handle_marshal_dump
174
- assert_nothing_raised do
175
- dump = Marshal.dump(Resource.new(@agent, :a => 1))
176
- resource = Marshal.load(dump)
177
- assert_equal 1, resource.a
178
- end
176
+ dump = Marshal.dump(Resource.new(@agent, :a => 1))
177
+ resource = Marshal.load(dump)
178
+ assert_equal 1, resource.a
179
179
  end
180
180
 
181
181
  def test_inspect
182
182
  resource = Resource.new @agent, :a => 1
183
- assert_equal "{:a=>1}\n", resource.inspect
183
+ assert_equal "{:a=>1}", resource.inspect
184
184
  end
185
185
 
186
186
  def test_each
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sawyer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Olson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-02 00:00:00.000000000 Z
12
+ date: 2016-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -35,16 +35,22 @@ dependencies:
35
35
  name: addressable
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.3.5
41
+ - - "<"
42
+ - !ruby/object:Gem::Version
43
+ version: '2.5'
41
44
  type: :runtime
42
45
  prerelease: false
43
46
  version_requirements: !ruby/object:Gem::Requirement
44
47
  requirements:
45
- - - "~>"
48
+ - - ">="
46
49
  - !ruby/object:Gem::Version
47
50
  version: 2.3.5
51
+ - - "<"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.5'
48
54
  description:
49
55
  email: technoweenie@gmail.com
50
56
  executables: []
@@ -94,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
100
  version: 1.3.5
95
101
  requirements: []
96
102
  rubyforge_project:
97
- rubygems_version: 2.2.2
103
+ rubygems_version: 2.4.5.1
98
104
  signing_key:
99
105
  specification_version: 2
100
106
  summary: Secret User Agent of HTTP