| 375 | | assert_nothing_raised { posts(:thinking).tags << push } |
|---|
| 376 | | assert_equal(count + 1, posts(:thinking).tags.size) |
|---|
| 377 | | assert_equal(count + 1, posts(:thinking).tags(true).size) |
|---|
| 378 | | |
|---|
| 379 | | assert_nothing_raised { posts(:thinking).tags.create!(:name => 'foo') } |
|---|
| 380 | | assert_equal(count + 2, posts(:thinking).tags.size) |
|---|
| 381 | | assert_equal(count + 2, posts(:thinking).tags(true).size) |
|---|
| 382 | | |
|---|
| 383 | | assert_nothing_raised { posts(:thinking).tags.concat(Tag.create!(:name => 'abc'), Tag.create!(:name => 'def')) } |
|---|
| 384 | | assert_equal(count + 4, posts(:thinking).tags.size) |
|---|
| 385 | | assert_equal(count + 4, posts(:thinking).tags(true).size) |
|---|
| | 375 | post_thinking = posts(:thinking) |
|---|
| | 376 | assert_nothing_raised { post_thinking.tags << push } |
|---|
| | 377 | assert_nil( wrong = post_thinking.tags.detect { |t| t.class != Tag }, |
|---|
| | 378 | message = "Expected a Tag in tags collection, got #{wrong.class}.") |
|---|
| | 379 | assert_nil( wrong = post_thinking.taggings.detect { |t| t.class != Tagging }, |
|---|
| | 380 | message = "Expected a Tagging in taggings collection, got #{wrong.class}.") |
|---|
| | 381 | assert_equal(count + 1, post_thinking.tags.size) |
|---|
| | 382 | assert_equal(count + 1, post_thinking.tags(true).size) |
|---|
| | 383 | |
|---|
| | 384 | assert_nothing_raised { post_thinking.tags.create!(:name => 'foo') } |
|---|
| | 385 | assert_nil( wrong = post_thinking.tags.detect { |t| t.class != Tag }, |
|---|
| | 386 | message = "Expected a Tag in tags collection, got #{wrong.class}.") |
|---|
| | 387 | assert_nil( wrong = post_thinking.taggings.detect { |t| t.class != Tagging }, |
|---|
| | 388 | message = "Expected a Tagging in taggings collection, got #{wrong.class}.") |
|---|
| | 389 | assert_equal(count + 2, post_thinking.tags.size) |
|---|
| | 390 | assert_equal(count + 2, post_thinking.tags(true).size) |
|---|
| | 391 | |
|---|
| | 392 | assert_nothing_raised { post_thinking.tags.concat(Tag.create!(:name => 'abc'), Tag.create!(:name => 'def')) } |
|---|
| | 393 | assert_nil( wrong = post_thinking.tags.detect { |t| t.class != Tag }, |
|---|
| | 394 | message = "Expected a Tag in tags collection, got #{wrong.class}.") |
|---|
| | 395 | assert_nil( wrong = post_thinking.taggings.detect { |t| t.class != Tagging }, |
|---|
| | 396 | message = "Expected a Tagging in taggings collection, got #{wrong.class}.") |
|---|
| | 397 | assert_equal(count + 4, post_thinking.tags.size) |
|---|
| | 398 | assert_equal(count + 4, post_thinking.tags(true).size) |
|---|