Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4886

Show
Ignore:
Timestamp:
08/31/06 07:55:31 (2 years ago)
Author:
bitsweat
Message:

site= accepts URIs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activeresource/CHANGELOG

    r4826 r4886  
    11*SVN* 
    22 
     3* site= accepts URIs.  [Jeremy Kemper] 
     4 
    35* Initial checkin: object-oriented client for restful HTTP resources which follow the Rails convention. [DHH] 
  • trunk/activeresource/lib/active_resource/base.rb

    r4492 r4886  
    55    class << self 
    66      def site=(site) 
    7         @@site = URI.parse(site) 
     7        @@site = site.is_a?(URI) ? site : URI.parse(site) 
    88      end 
    9        
     9 
    1010      def site 
    1111        @@site 
  • trunk/activeresource/test/base_test.rb

    r4492 r4886  
    1717    ) 
    1818  end 
     19 
     20 
     21  def test_site_accessor_accepts_uri_or_string_argument 
     22    site = URI.parse('http://localhost') 
     23 
     24    assert_nothing_raised { Person.site = 'http://localhost' } 
     25    assert_equal site, Person.site 
     26 
     27    assert_nothing_raised { Person.site = site } 
     28    assert_equal site, Person.site 
     29  end 
     30 
    1931 
    2032  def test_collection_name