Commit Graph

226 Commits

Author SHA1 Message Date
Xinjiang Lu
ec55866e39 Support include_root_in_json for ActiveResource properly.
This commit is a backport from
https://github.com/rails/activeresource/pull/29. The
ActiveResource's include_root_in_json option is broken for 3.2.x.
2013-05-15 20:22:18 -04:00
Prem Sichanugrist
e134e171c2 Remove test for XML YAML parsing
The support for YAML parsing in XML has been removed from Active Support
since it introduced an security risk. See 43109ec for more detail.
2013-01-08 19:39:25 -05:00
Carlos Antonio da Silva
17ccefc436 Update mocha version to 0.13.0 and change requires 2012-11-13 09:24:43 -02:00
Sergey Nartimov
4f440a3833 fix base64 requires 2012-01-03 01:18:34 +03:00
Sergey Nartimov
5f09414f85 deprecate ActiveSupport::Base64
extend and define ::Base64 if needed
2012-01-03 00:57:03 +03:00
Jeremy Kemper
b8bb5f44c8 Treat 303 See Other as a redirect response, too 2011-10-11 21:01:11 -07:00
Jim Herzberg
a78a75d67a activeresource should treat HTTP status 307 as redirection, same as 301 and 302; added missing test cases for statii 301 and 302. 2011-10-11 17:46:24 -07:00
Colin Shield & Ian Lesperance
41365a8275 Fixed digest authentication for requests with a query string [#3158] 2011-09-28 15:23:47 -07:00
Jon Leighton
a15424b92c Make serializable_hash take attr values directly from attributes hash.
Previously, it would use send() to get the attribute. In Active
Resource, this would rely on hitting method missing. If a method with
the same name was defined further up the ancestor chain, that method
would wrongly be called.

This change fixes test_to_xml_with_private_method_name_as_attribute in
activeresource/test/cases/base_test.rb, which was broken after
51bef9d8fb, because that change made
to_xml use serializable_hash.
2011-09-26 12:40:03 +01:00
Jon Leighton
8397a564cb Merge pull request #2678 from jmileham/ares_content_length_bug
ActiveResource shouldn't rely on the presence of Content-Length
2011-09-12 10:11:39 -07:00
Arun Agrawal
fb73be8469 Not used variables removed. Warnings removed. 2011-09-10 09:38:57 +05:30
John Mileham
f776661fd2 Failing test: ActiveResource shouldn't rely on the presence of Content-Length 2011-09-09 19:05:26 -04:00
Marc G Gauthier
28d605ff7f Do not use objects that don't respond to to_sym (integers, floats, dates...) as parameters 2011-09-01 18:26:29 +02:00
Lachlan Sylvester
7e13284645 fix some types in schema_test.rb 2011-07-27 17:01:50 +10:00
Santiago Pastorino
1d3618a9b4 remove warning: assigned but unused variable 2011-06-08 00:26:09 -03:00
Arun Agrawal
4c99f323ad Not loading ruby-debug specially. 2011-05-22 03:12:47 +05:30
Arun Agrawal
1ffc3063b7 No more need rubygems here. 2011-05-22 02:02:56 +05:30
Josh Kalderimis
00958696d8 corrected some further tests and docs for the ARes change to json change 2011-05-18 00:34:10 -04:00
Josh Kalderimis
6b4bbb4274 updated all the tests in ARes to work with json 2011-05-18 00:34:09 -04:00
Josh Kalderimis
4a9365ee18 move the ARes conn test to the correct location 2011-05-18 00:34:09 -04:00
Josh Kalderimis
6062017382 remove a circular dependency 2011-05-18 00:34:09 -04:00
Sebastian Martinez
21b61a8ac4 Follow code conventions on some tests 2011-05-10 20:58:36 -03:00
Paolo "Nusco" Perrotta
24e4ea582b Fixed minor typo in comment 2011-04-26 16:15:20 -07:00
Prem Sichanugrist
733bfa63f5 Remove #among? from Active Support
After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now.

It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
2011-04-13 20:25:28 +08:00
David Heinemeier Hansson
d1575ae1b9 Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion! 2011-04-12 00:23:07 +02:00
Prem Sichanugrist
a9f3c9da01 Using Object#in? and Object#either? in various places
There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
2011-04-11 03:17:09 +08:00
R.T. Lechow
48841dd6ae Active Resource typos. 2011-03-05 11:56:34 +01:00
Ken Mazaika
1bedee5631 ActiveResource validation tests did not test ActiveModel validations. Adjust the test to be done the Rails3 way.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-15 12:04:42 -02:00
Josh Bassett
056be15212 Fixed a bug where ActiveResource::HttpMock would not replace an existing response when passing a block to the respond_to method.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2011-02-09 19:25:53 -02:00
Santiago Pastorino
d891ad4e92 Make ARes tests unescape [ and ] 2010-11-18 23:52:17 -02:00
Gaston Ramos
aee043de5a - ActiveResource::HttpMock.respond_to
do not replace the response with the same path but different method
- Fix typo

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-07 16:50:41 +02:00
Gaston Ramos
b9f8501f82 - Fix ActiveResource::HttpMock.respond_to replace the response
if it has the same request

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-10-07 16:50:34 +02:00
Aaron Patterson
ef8ce78ba1 changing map and include to find 2010-09-30 11:00:14 -07:00
Neeraj Singh
0495736339 assert on empty array is always true. fixing test. 2010-09-30 23:57:55 +08:00
Matthijs Langenberg
67a838574b Fix broken module namespacing in ActiveResource with Ruby 1.9 [#5699 state:resolved]
Following namespace use case was broken with Ruby 1.9:

  class Author < ActiveRecord::Base
    ...
  end

  module Api
    class Book < ActiveResouce::Base
    end
  end

Let's say XML contains <book><author><name>John</name></author>....

  Api::Book.first.author.class.to_s #=>
    Ruby 1.8.7: "Api::Book::Author" (namespaced, correct),
    Ruby 1.9: "Author" (toplevel, broken)

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-27 23:10:55 +02:00
Gaston Ramos
f85b38a36b - added mock to test ActiveResource::MissingPrefixParam in finder_test 2010-09-27 15:25:44 -03:00
Gaston Ramos
823a8e6e66 - check prefix options in collection_path 2010-09-27 15:25:33 -03:00
Gaston Ramos
9363931f34 - better name for prefix param test case 2010-09-27 15:25:28 -03:00
Gaston Ramos
a71e07d61e - elmenth_path raise an ActiveResource::MissingPrefixParam exception when prefix_options does not has all required prefix_options ex: class StreetAddress < ActiveResource::Base self.site = "http://37s.sunrise.i:3000/people/:person_id/" end
StreetAddress.element_path(1)
    # => ActiveResource::MissingPrefixParam
2010-09-27 15:25:16 -03:00
José Valim
e0c344dc49 Fix active_resource assertions. 2010-09-25 17:56:56 +02:00
Jacques Crocker
51f1f550da Allow per Resource format settings
Previously, ActiveResource was using the connection level formatter for get requests. This made it impossible to use custom formatters per resource.

Additionally this commit makes the Connection request methods more consistent. It always returns a Response. The base will then decode it each the response using its format setting.

Merging this commit will allow users to add custom formatters on a per Resource basis. This enables handling pagination responses from the server side, a very common use case that was previously impossible without monkeypatching XmlFormat.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 13:54:09 +02:00
Jacques Crocker
ee5ef67c44 Allow ActiveResource to work with non-generated ids [#5660 state:resolved]
This commit updates new? so that it knows whether or not the record was actually new or not, and doesn't rely solely on the presence of id. This enables the ability to set a custom primary_key that is not autogenerated by the server.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 11:15:40 +02:00
Xavier Noria
8c0c815ba7 resolves rdoc conflict 2010-09-23 22:35:08 +02:00
Neeraj Singh
39debfc854 test for #5038 2010-09-18 20:49:41 +02:00
Emilio Tagua
f2765a1cb3 Refactor setup methods by extracting them in abstract_unit, remove TODO.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-17 17:03:58 +02:00
Emilio Tagua
a521a3c05a Remove TODO and support all expected attributes.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-17 17:03:51 +02:00
Alexey Mahotkin
dfebdb1b03 Tiny fixes to rdoc 2010-09-16 17:10:36 +04:00
Carlos Antonio da Silva
a18b73b43c Remove all deprecation warnings in activeresource
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:38:38 +02:00
José Valim
599e46bf24 Revert "Setup explicit requires for files with exceptions. Removed them from autoloading."
Booting a new Rails application does not work after this commit [#5359 state:open]

This reverts commit 38a421b34d.
2010-09-02 21:11:03 +02:00
Andreas Garnæs
1503e45e2e ActiveModel#to_xml fix (renamed parameter).
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-02 12:55:45 +02:00