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