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
@@ -10,7 +10,7 @@ class ArticleBlock < Block | @@ -10,7 +10,7 @@ class ArticleBlock < Block | ||
10 | 10 | ||
11 | def content(args={}) | 11 | def content(args={}) |
12 | block = self | 12 | block = self |
13 | - lambda do | 13 | + proc do |
14 | block_title(block.title) + | 14 | block_title(block.title) + |
15 | (block.article ? article_to_html(block.article, | 15 | (block.article ? article_to_html(block.article, |
16 | :gallery_view => false, | 16 | :gallery_view => false, |
test/unit/article_block_test.rb
@@ -34,7 +34,9 @@ class ArticleBlockTest < ActiveSupport::TestCase | @@ -34,7 +34,9 @@ class ArticleBlockTest < ActiveSupport::TestCase | ||
34 | should 'not crash when referenced article is removed' do | 34 | should 'not crash when referenced article is removed' do |
35 | person = create_user('testuser').person | 35 | person = create_user('testuser').person |
36 | a = person.articles.create!(:name => 'test') | 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 | person.boxes.first.blocks << block | 40 | person.boxes.first.blocks << block |
39 | block.save! | 41 | block.save! |
40 | 42 | ||
@@ -58,7 +60,9 @@ class ArticleBlockTest < ActiveSupport::TestCase | @@ -58,7 +60,9 @@ class ArticleBlockTest < ActiveSupport::TestCase | ||
58 | person.articles.delete_all | 60 | person.articles.delete_all |
59 | assert_equal [], person.articles | 61 | assert_equal [], person.articles |
60 | a = person.articles.create!(:name => 'test') | 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 | person.boxes.first.blocks << block | 66 | person.boxes.first.blocks << block |
63 | block.save! | 67 | block.save! |
64 | 68 |