aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-05-19 15:14:51 -0400
committerJosé Valim <jose.valim@gmail.com>2010-05-19 21:31:51 +0200
commit39a246f545a714b21c669e2f6eda4012526c3874 (patch)
tree89da32733821f0a7dcc56efdac82c72897eca424 /activeresource
parentbdb2871df7fb0a1eeceadb31aaba4d160df508aa (diff)
downloadrails-39a246f545a714b21c669e2f6eda4012526c3874.tar.gz
rails-39a246f545a714b21c669e2f6eda4012526c3874.tar.bz2
rails-39a246f545a714b21c669e2f6eda4012526c3874.zip
Final iteration of use better testing methods
[#4652 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/test/cases/base/schema_test.rb12
-rw-r--r--activeresource/test/cases/base_test.rb10
2 files changed, 11 insertions, 11 deletions
diff --git a/activeresource/test/cases/base/schema_test.rb b/activeresource/test/cases/base/schema_test.rb
index d9dc679941..136c827926 100644
--- a/activeresource/test/cases/base/schema_test.rb
+++ b/activeresource/test/cases/base/schema_test.rb
@@ -185,7 +185,7 @@ class SchemaTest < ActiveModel::TestCase
####
test "should be able to use schema" do
- assert Person.respond_to?(:schema), "should at least respond to the schema method"
+ assert_respond_to Person, :schema, "should at least respond to the schema method"
assert_nothing_raised("Should allow the schema to take a block") do
Person.schema { }
@@ -199,7 +199,7 @@ class SchemaTest < ActiveModel::TestCase
s = self
attribute :foo, :string
end
- assert s.respond_to?(:attrs), "should return attributes in theory"
+ assert_respond_to s, :attrs, "should return attributes in theory"
assert_equal({'foo' => 'string' }, s.attrs, "should return attributes in practice")
end
end
@@ -308,8 +308,8 @@ class SchemaTest < ActiveModel::TestCase
Person.schema { string new_attr_name_two }
end
- assert Person.new.respond_to?(new_attr_name), "should respond to the attribute in a passed-in schema, but failed on: #{new_attr_name}"
- assert Person.new.respond_to?(new_attr_name_two), "should respond to the attribute from the schema, but failed on: #{new_attr_name_two}"
+ assert_respond_to Person.new, new_attr_name, "should respond to the attribute in a passed-in schema, but failed on: #{new_attr_name}"
+ assert_respond_to Person.new, new_attr_name_two, "should respond to the attribute from the schema, but failed on: #{new_attr_name_two}"
end
test "should not care about ordering of schema definitions" do
@@ -326,8 +326,8 @@ class SchemaTest < ActiveModel::TestCase
Person.schema = {new_attr_name.to_s => 'string'}
end
- assert Person.new.respond_to?(new_attr_name), "should respond to the attribute in a passed-in schema, but failed on: #{new_attr_name}"
- assert Person.new.respond_to?(new_attr_name_two), "should respond to the attribute from the schema, but failed on: #{new_attr_name_two}"
+ assert_respond_to Person.new, new_attr_name, "should respond to the attribute in a passed-in schema, but failed on: #{new_attr_name}"
+ assert_respond_to Person.new, new_attr_name_two, "should respond to the attribute from the schema, but failed on: #{new_attr_name_two}"
end
# method_missing effects
diff --git a/activeresource/test/cases/base_test.rb b/activeresource/test/cases/base_test.rb
index daf58613c0..d5ee7659af 100644
--- a/activeresource/test/cases/base_test.rb
+++ b/activeresource/test/cases/base_test.rb
@@ -671,9 +671,9 @@ class BaseTest < Test::Unit::TestCase
########################################################################
def test_respond_to
matz = Person.find(1)
- assert matz.respond_to?(:name)
- assert matz.respond_to?(:name=)
- assert matz.respond_to?(:name?)
+ assert_respond_to matz, :name
+ assert_respond_to matz, :name=
+ assert_respond_to matz, :name?
assert !matz.respond_to?(:super_scalable_stuff)
end
@@ -708,7 +708,7 @@ class BaseTest < Test::Unit::TestCase
def test_id_from_response_without_location
p = Person.new
resp = {}
- assert_equal nil, p.__send__(:id_from_response, resp)
+ assert_nil p.__send__(:id_from_response, resp)
end
def test_create_with_custom_prefix
@@ -775,7 +775,7 @@ class BaseTest < Test::Unit::TestCase
mock.post "/people.xml", {}, nil, 201
end
person = Person.create(:name => 'Rick')
- assert_equal nil, person.id
+ assert_nil person.id
end
def test_clone