Instiki 0.16.3: Rails 2.3.0
Instiki now runs on the Rails 2.3.0 Candidate Release. Among other improvements, this means that it now automagically selects between WEBrick and Mongrel. Just run ./instiki --daemon
This commit is contained in:
parent
43aadecc99
commit
4e14ccc74d
893 changed files with 71965 additions and 28511 deletions
95
vendor/rails/activeresource/test/base_test.rb
vendored
95
vendor/rails/activeresource/test/base_test.rb
vendored
|
@ -627,6 +627,12 @@ class BaseTest < Test::Unit::TestCase
|
|||
assert_equal '1', p.__send__(:id_from_response, resp)
|
||||
end
|
||||
|
||||
def test_id_from_response_without_location
|
||||
p = Person.new
|
||||
resp = {}
|
||||
assert_equal nil, p.__send__(:id_from_response, resp)
|
||||
end
|
||||
|
||||
def test_create_with_custom_prefix
|
||||
matzs_house = StreetAddress.new(:person_id => 1)
|
||||
matzs_house.save
|
||||
|
@ -670,7 +676,6 @@ class BaseTest < Test::Unit::TestCase
|
|||
assert_equal person, person.reload
|
||||
end
|
||||
|
||||
|
||||
def test_create
|
||||
rick = Person.create(:name => 'Rick')
|
||||
assert rick.valid?
|
||||
|
@ -687,40 +692,48 @@ class BaseTest < Test::Unit::TestCase
|
|||
assert_raises(ActiveResource::ResourceConflict) { Person.create(:name => 'Rick') }
|
||||
end
|
||||
|
||||
def test_create_without_location
|
||||
ActiveResource::HttpMock.respond_to do |mock|
|
||||
mock.post "/people.xml", {}, nil, 201
|
||||
end
|
||||
person = Person.create(:name => 'Rick')
|
||||
assert_equal nil, person.id
|
||||
end
|
||||
|
||||
def test_clone
|
||||
matz = Person.find(1)
|
||||
matz_c = matz.clone
|
||||
assert matz_c.new?
|
||||
matz.attributes.each do |k, v|
|
||||
assert_equal v, matz_c.send(k) if k != Person.primary_key
|
||||
end
|
||||
end
|
||||
matz = Person.find(1)
|
||||
matz_c = matz.clone
|
||||
assert matz_c.new?
|
||||
matz.attributes.each do |k, v|
|
||||
assert_equal v, matz_c.send(k) if k != Person.primary_key
|
||||
end
|
||||
end
|
||||
|
||||
def test_nested_clone
|
||||
addy = StreetAddress.find(1, :params => {:person_id => 1})
|
||||
addy_c = addy.clone
|
||||
assert addy_c.new?
|
||||
addy.attributes.each do |k, v|
|
||||
assert_equal v, addy_c.send(k) if k != StreetAddress.primary_key
|
||||
end
|
||||
assert_equal addy.prefix_options, addy_c.prefix_options
|
||||
end
|
||||
def test_nested_clone
|
||||
addy = StreetAddress.find(1, :params => {:person_id => 1})
|
||||
addy_c = addy.clone
|
||||
assert addy_c.new?
|
||||
addy.attributes.each do |k, v|
|
||||
assert_equal v, addy_c.send(k) if k != StreetAddress.primary_key
|
||||
end
|
||||
assert_equal addy.prefix_options, addy_c.prefix_options
|
||||
end
|
||||
|
||||
def test_complex_clone
|
||||
matz = Person.find(1)
|
||||
matz.address = StreetAddress.find(1, :params => {:person_id => matz.id})
|
||||
matz.non_ar_hash = {:not => "an ARes instance"}
|
||||
matz.non_ar_arr = ["not", "ARes"]
|
||||
matz_c = matz.clone
|
||||
assert matz_c.new?
|
||||
assert_raises(NoMethodError) {matz_c.address}
|
||||
assert_equal matz.non_ar_hash, matz_c.non_ar_hash
|
||||
assert_equal matz.non_ar_arr, matz_c.non_ar_arr
|
||||
def test_complex_clone
|
||||
matz = Person.find(1)
|
||||
matz.address = StreetAddress.find(1, :params => {:person_id => matz.id})
|
||||
matz.non_ar_hash = {:not => "an ARes instance"}
|
||||
matz.non_ar_arr = ["not", "ARes"]
|
||||
matz_c = matz.clone
|
||||
assert matz_c.new?
|
||||
assert_raises(NoMethodError) {matz_c.address}
|
||||
assert_equal matz.non_ar_hash, matz_c.non_ar_hash
|
||||
assert_equal matz.non_ar_arr, matz_c.non_ar_arr
|
||||
|
||||
# Test that actual copy, not just reference copy
|
||||
matz.non_ar_hash[:not] = "changed"
|
||||
assert_not_equal matz.non_ar_hash, matz_c.non_ar_hash
|
||||
end
|
||||
# Test that actual copy, not just reference copy
|
||||
matz.non_ar_hash[:not] = "changed"
|
||||
assert_not_equal matz.non_ar_hash, matz_c.non_ar_hash
|
||||
end
|
||||
|
||||
def test_update
|
||||
matz = Person.find(:first)
|
||||
|
@ -811,9 +824,9 @@ class BaseTest < Test::Unit::TestCase
|
|||
def test_exists_with_redefined_to_param
|
||||
Person.module_eval do
|
||||
alias_method :original_to_param_exists, :to_param
|
||||
def to_param
|
||||
name
|
||||
end
|
||||
def to_param
|
||||
name
|
||||
end
|
||||
end
|
||||
|
||||
# Class method.
|
||||
|
@ -828,13 +841,13 @@ class BaseTest < Test::Unit::TestCase
|
|||
# Nested instance method.
|
||||
assert StreetAddress.find(1, :params => { :person_id => Person.find('Greg').to_param }).exists?
|
||||
|
||||
ensure
|
||||
# revert back to original
|
||||
Person.module_eval do
|
||||
# save the 'new' to_param so we don't get a warning about discarding the method
|
||||
alias_method :exists_to_param, :to_param
|
||||
alias_method :to_param, :original_to_param_exists
|
||||
end
|
||||
ensure
|
||||
# revert back to original
|
||||
Person.module_eval do
|
||||
# save the 'new' to_param so we don't get a warning about discarding the method
|
||||
alias_method :exists_to_param, :to_param
|
||||
alias_method :to_param, :original_to_param_exists
|
||||
end
|
||||
end
|
||||
|
||||
def test_to_xml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue