aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-11-22 18:39:24 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2008-11-22 19:19:13 -0800
commitdc07c0e02b16031e5ff7cf650f0894654d525a03 (patch)
tree31c23ecdbbb06aa6c998a1f2ddfbe67dfa02f96a /activeresource/test
parent0e2d18e415118afed2df148e5d7302ef0361b569 (diff)
downloadrails-dc07c0e02b16031e5ff7cf650f0894654d525a03.tar.gz
rails-dc07c0e02b16031e5ff7cf650f0894654d525a03.tar.bz2
rails-dc07c0e02b16031e5ff7cf650f0894654d525a03.zip
Fix indentation mismatches
Diffstat (limited to 'activeresource/test')
-rw-r--r--activeresource/test/base_test.rb86
-rw-r--r--activeresource/test/format_test.rb26
2 files changed, 56 insertions, 56 deletions
diff --git a/activeresource/test/base_test.rb b/activeresource/test/base_test.rb
index bb08098683..d37a6d4ed2 100644
--- a/activeresource/test/base_test.rb
+++ b/activeresource/test/base_test.rb
@@ -688,39 +688,39 @@ class BaseTest < Test::Unit::TestCase
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
-
- 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
-
- # 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
+ 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_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
def test_update
matz = Person.find(:first)
@@ -811,9 +811,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 +828,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
diff --git a/activeresource/test/format_test.rb b/activeresource/test/format_test.rb
index 01cc162075..3194c2dcd1 100644
--- a/activeresource/test/format_test.rb
+++ b/activeresource/test/format_test.rb
@@ -85,20 +85,20 @@ class FormatTest < Test::Unit::TestCase
end
def test_serialization_of_nested_resource
- address = { :street => '12345 Street' }
- person = { :name=> 'Rus', :address => address}
+ address = { :street => '12345 Street' }
+ person = { :name=> 'Rus', :address => address}
- [:json, :xml].each do |format|
- encoded_person = ActiveResource::Formats[format].encode(person)
- assert_match(/12345 Street/, encoded_person)
- remote_person = Person.new(person.update({:address => StreetAddress.new(address)}))
- assert_kind_of StreetAddress, remote_person.address
- using_format(Person, format) do
- ActiveResource::HttpMock.respond_to.post "/people.#{format}", {'Content-Type' => ActiveResource::Formats[format].mime_type}, encoded_person, 201, {'Location' => "/people/5.#{format}"}
- remote_person.save
- end
- end
- end
+ [:json, :xml].each do |format|
+ encoded_person = ActiveResource::Formats[format].encode(person)
+ assert_match(/12345 Street/, encoded_person)
+ remote_person = Person.new(person.update({:address => StreetAddress.new(address)}))
+ assert_kind_of StreetAddress, remote_person.address
+ using_format(Person, format) do
+ ActiveResource::HttpMock.respond_to.post "/people.#{format}", {'Content-Type' => ActiveResource::Formats[format].mime_type}, encoded_person, 201, {'Location' => "/people/5.#{format}"}
+ remote_person.save
+ end
+ end
+ end
private
def using_format(klass, mime_type_reference)