Commit 1771bd86d78f0ff8cd86898960fec6ce8117f7ab
1 parent
56703bf0
Exists in
master
and in
29 other branches
Fix HighlightsBlock unit test
Showing
4 changed files
with
9 additions
and
5 deletions
Show diff stats
app/models/block.rb
app/models/highlights_block.rb
1 | 1 | class HighlightsBlock < Block |
2 | 2 | |
3 | + attr_accessible :images | |
4 | + | |
3 | 5 | settings_items :images, :type => Array, :default => [] |
4 | 6 | settings_items :interval, :type => 'integer', :default => 4 |
5 | 7 | settings_items :shuffle, :type => 'boolean', :default => false |
... | ... | @@ -30,7 +32,7 @@ class HighlightsBlock < Block |
30 | 32 | |
31 | 33 | def content(args={}) |
32 | 34 | block = self |
33 | - lambda do | |
35 | + proc do | |
34 | 36 | render :file => 'blocks/highlights', :locals => { :block => block } |
35 | 37 | end |
36 | 38 | end | ... | ... |
app/models/link_list_block.rb
test/unit/highlights_block_test.rb
... | ... | @@ -60,7 +60,9 @@ class HighlightsBlockTest < ActiveSupport::TestCase |
60 | 60 | should 'be able to update display setting' do |
61 | 61 | user = create_user('testinguser').person |
62 | 62 | box = fast_create(Box, :owner_id => user.id) |
63 | - block = HighlightsBlock.create!(:display => 'never', :box => box) | |
63 | + block = HighlightsBlock.create!(:display => 'never').tap do |b| | |
64 | + b.box = box | |
65 | + end | |
64 | 66 | assert block.update_attributes!(:display => 'always') |
65 | 67 | block.reload |
66 | 68 | assert_equal 'always', block.display |
... | ... | @@ -143,7 +145,7 @@ class HighlightsBlockTest < ActiveSupport::TestCase |
143 | 145 | block = HighlightsBlock.new |
144 | 146 | block.stubs(:owner).returns(owner) |
145 | 147 | |
146 | - assert_kind_of Array, block.folder_choices | |
148 | + assert_equal [], block.folder_choices | |
147 | 149 | end |
148 | 150 | end |
149 | 151 | ... | ... |