activeresource 2.0.5 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activeresource might be problematic. Click here for more details.

@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/abstract_unit"
1
+ require 'abstract_unit'
2
2
 
3
3
  class ConnectionTest < Test::Unit::TestCase
4
4
  ResponseCodeStub = Struct.new(:code)
@@ -27,6 +27,7 @@ class ConnectionTest < Test::Unit::TestCase
27
27
  mock.delete "/people/2.xml", @header, nil, 200
28
28
  mock.post "/people.xml", {}, nil, 201, 'Location' => '/people/5.xml'
29
29
  mock.post "/members.xml", {}, @header, 201, 'Location' => '/people/6.xml'
30
+ mock.head "/people/1.xml", {}, nil, 200
30
31
  end
31
32
  end
32
33
 
@@ -100,11 +101,22 @@ class ConnectionTest < Test::Unit::TestCase
100
101
  assert_equal site, @conn.site
101
102
  end
102
103
 
104
+ def test_timeout_accessor
105
+ @conn.timeout = 5
106
+ assert_equal 5, @conn.timeout
107
+ end
108
+
103
109
  def test_get
104
110
  matz = @conn.get("/people/1.xml")
105
111
  assert_equal "Matz", matz["name"]
106
112
  end
107
113
 
114
+ def test_head
115
+ response = @conn.head("/people/1.xml")
116
+ assert response.body.blank?
117
+ assert_equal 200, response.code
118
+ end
119
+
108
120
  def test_get_with_header
109
121
  david = @conn.get("/people/2.xml", @header)
110
122
  assert_equal "David", david["name"]
@@ -156,6 +168,15 @@ class ConnectionTest < Test::Unit::TestCase
156
168
  assert_equal 200, response.code
157
169
  end
158
170
 
171
+ uses_mocha('test_timeout') do
172
+ def test_timeout
173
+ @http = mock('new Net::HTTP')
174
+ @conn.expects(:http).returns(@http)
175
+ @http.expects(:get).raises(Timeout::Error, 'execution expired')
176
+ assert_raises(ActiveResource::TimeoutError) { @conn.get('/people_timeout.xml') }
177
+ end
178
+ end
179
+
159
180
  protected
160
181
  def assert_response_raises(klass, code)
161
182
  assert_raise(klass, "Expected response code #{code} to raise #{klass}") do
data/test/format_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "#{File.dirname(__FILE__)}/abstract_unit"
1
+ require 'abstract_unit'
2
2
  require "fixtures/person"
3
3
 
4
4
  class FormatTest < Test::Unit::TestCase
@@ -80,4 +80,4 @@ class FormatTest < Test::Unit::TestCase
80
80
  ensure
81
81
  klass.format = previous_format
82
82
  end
83
- end
83
+ end
data/test/setter_trap.rb CHANGED
@@ -1,4 +1,4 @@
1
- class SetterTrap < BasicObject
1
+ class SetterTrap < ActiveSupport::BasicObject
2
2
  class << self
3
3
  def rollback_sets(obj)
4
4
  returning yield(setter_trap = new(obj)) do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeresource
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,18 +9,17 @@ autorequire: active_resource
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-19 00:00:00 +02:00
12
+ date: 2008-05-31 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
- type: :runtime
18
17
  version_requirement:
19
18
  version_requirements: !ruby/object:Gem::Requirement
20
19
  requirements:
21
20
  - - "="
22
21
  - !ruby/object:Gem::Version
23
- version: 2.0.5
22
+ version: 2.1.0
24
23
  version:
25
24
  description: Wraps web resources in model classes that can be manipulated through XML over REST.
26
25
  email: david@loudthinking.com
@@ -85,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
84
  requirements: []
86
85
 
87
86
  rubyforge_project: activeresource
88
- rubygems_version: 1.2.0
87
+ rubygems_version: 1.0.1
89
88
  signing_key:
90
89
  specification_version: 2
91
90
  summary: Think Active Record for web resources.