Commit 1771bd86d78f0ff8cd86898960fec6ce8117f7ab

Authored by Leandro Santos
1 parent 56703bf0

Fix HighlightsBlock unit test

app/models/block.rb
1 1 class Block < ActiveRecord::Base
2 2  
3   - attr_accessible :title
  3 + attr_accessible :title, :display
4 4  
5 5 # to be able to generate HTML
6 6 include ActionView::Helpers::UrlHelper
... ...
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 &lt; 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
1 1 class LinkListBlock < Block
2 2  
3   - attr_accessible :links, :display
  3 + attr_accessible :links
4 4  
5 5 ICONS = [
6 6 ['no-icon', _('(No icon)')],
... ...
test/unit/highlights_block_test.rb
... ... @@ -60,7 +60,9 @@ class HighlightsBlockTest &lt; 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 &lt; 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  
... ...