Commit cf841a425c15ee09619d5ee411a6cc1092468c98
1 parent
2f588add
Exists in
staging
and in
42 other branches
Fix partially ArticleBlock unit test
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
app/models/article_block.rb
test/unit/article_block_test.rb
| ... | ... | @@ -34,7 +34,9 @@ class ArticleBlockTest < ActiveSupport::TestCase |
| 34 | 34 | should 'not crash when referenced article is removed' do |
| 35 | 35 | person = create_user('testuser').person |
| 36 | 36 | a = person.articles.create!(:name => 'test') |
| 37 | - block = ArticleBlock.create(:article => a) | |
| 37 | + block = ArticleBlock.create.tap do |b| | |
| 38 | + b.article = a | |
| 39 | + end | |
| 38 | 40 | person.boxes.first.blocks << block |
| 39 | 41 | block.save! |
| 40 | 42 | |
| ... | ... | @@ -58,7 +60,9 @@ class ArticleBlockTest < ActiveSupport::TestCase |
| 58 | 60 | person.articles.delete_all |
| 59 | 61 | assert_equal [], person.articles |
| 60 | 62 | a = person.articles.create!(:name => 'test') |
| 61 | - block = ArticleBlock.create(:article => a) | |
| 63 | + block = ArticleBlock.create.tap do |b| | |
| 64 | + b.article = a | |
| 65 | + end | |
| 62 | 66 | person.boxes.first.blocks << block |
| 63 | 67 | block.save! |
| 64 | 68 | ... | ... |