Commit c9e6851d0ae50a2e8c533dd1d5f11da396b61325
1 parent
5a265683
Exists in
master
and in
20 other branches
rails4: do not assert ActiveRecord::Relation as rails changes it
Showing
3 changed files
with
4 additions
and
7 deletions
Show diff stats
test/unit/organization_test.rb
@@ -130,7 +130,7 @@ class OrganizationTest < ActiveSupport::TestCase | @@ -130,7 +130,7 @@ class OrganizationTest < ActiveSupport::TestCase | ||
130 | 130 | ||
131 | should 'list pending enterprise validations' do | 131 | should 'list pending enterprise validations' do |
132 | org = Organization.new | 132 | org = Organization.new |
133 | - assert_kind_of ActiveRecord::Relation, org.pending_validations | 133 | + assert org.pending_validations.empty? |
134 | end | 134 | end |
135 | 135 | ||
136 | should 'be able to find a pending validation by its code' do | 136 | should 'be able to find a pending validation by its code' do |
@@ -148,7 +148,7 @@ class OrganizationTest < ActiveSupport::TestCase | @@ -148,7 +148,7 @@ class OrganizationTest < ActiveSupport::TestCase | ||
148 | 148 | ||
149 | should 'be able to find already processed validations' do | 149 | should 'be able to find already processed validations' do |
150 | org = Organization.new | 150 | org = Organization.new |
151 | - assert_kind_of ActiveRecord::Relation, org.processed_validations | 151 | + assert org.processed_validations.empty? |
152 | end | 152 | end |
153 | 153 | ||
154 | should 'be able to find an already processed validation by its code' do | 154 | should 'be able to find an already processed validation by its code' do |
@@ -188,7 +188,7 @@ class OrganizationTest < ActiveSupport::TestCase | @@ -188,7 +188,7 @@ class OrganizationTest < ActiveSupport::TestCase | ||
188 | org.foundation_year = 20.07 | 188 | org.foundation_year = 20.07 |
189 | org.valid? | 189 | org.valid? |
190 | assert org.errors[:foundation_year.to_s].present? | 190 | assert org.errors[:foundation_year.to_s].present? |
191 | - | 191 | + |
192 | org.foundation_year = 2007 | 192 | org.foundation_year = 2007 |
193 | org.valid? | 193 | org.valid? |
194 | assert ! org.errors[:foundation_year.to_s].present? | 194 | assert ! org.errors[:foundation_year.to_s].present? |
@@ -208,7 +208,7 @@ class OrganizationTest < ActiveSupport::TestCase | @@ -208,7 +208,7 @@ class OrganizationTest < ActiveSupport::TestCase | ||
208 | 208 | ||
209 | assert o.members.include?(p), "Organization should add the new member" | 209 | assert o.members.include?(p), "Organization should add the new member" |
210 | end | 210 | end |
211 | - | 211 | + |
212 | should 'allow to remove members' do | 212 | should 'allow to remove members' do |
213 | c = fast_create(Organization) | 213 | c = fast_create(Organization) |
214 | p = create_user('myothertestuser').person | 214 | p = create_user('myothertestuser').person |
test/unit/person_test.rb
@@ -1346,14 +1346,12 @@ class PersonTest < ActiveSupport::TestCase | @@ -1346,14 +1346,12 @@ class PersonTest < ActiveSupport::TestCase | ||
1346 | 1346 | ||
1347 | abusers = Person.abusers | 1347 | abusers = Person.abusers |
1348 | 1348 | ||
1349 | - assert_equal ActiveRecord::Relation, abusers.class | ||
1350 | assert_includes abusers, abuser1 | 1349 | assert_includes abusers, abuser1 |
1351 | assert_includes abusers, abuser2 | 1350 | assert_includes abusers, abuser2 |
1352 | assert_not_includes abusers, person | 1351 | assert_not_includes abusers, person |
1353 | 1352 | ||
1354 | non_abusers = Person.non_abusers | 1353 | non_abusers = Person.non_abusers |
1355 | 1354 | ||
1356 | - assert_equal ActiveRecord::Relation, non_abusers.class | ||
1357 | assert_not_includes non_abusers, abuser1 | 1355 | assert_not_includes non_abusers, abuser1 |
1358 | assert_not_includes non_abusers, abuser2 | 1356 | assert_not_includes non_abusers, abuser2 |
1359 | assert_includes non_abusers, person | 1357 | assert_includes non_abusers, person |
test/unit/product_category_test.rb
@@ -53,7 +53,6 @@ class ProductCategoryTest < ActiveSupport::TestCase | @@ -53,7 +53,6 @@ class ProductCategoryTest < ActiveSupport::TestCase | ||
53 | 53 | ||
54 | scope = ProductCategory.by_enterprise(enterprise) | 54 | scope = ProductCategory.by_enterprise(enterprise) |
55 | 55 | ||
56 | - assert_equal ActiveRecord::Relation, scope.class | ||
57 | assert_equivalent [c1,c2], scope | 56 | assert_equivalent [c1,c2], scope |
58 | end | 57 | end |
59 | 58 |