Commit 358c5f33d297f68b01aa1ad83fe853db61ed1689
1 parent
f34c90d0
Exists in
master
and in
29 other branches
ActionItem154: making blocks refer to their owner trough their box
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1257 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
21 additions
and
0 deletions
Show diff stats
app/models/block.rb
test/unit/block_test.rb
... | ... | @@ -14,5 +14,22 @@ class BlockTest < Test::Unit::TestCase |
14 | 14 | |
15 | 15 | assert_kind_of Hash, Block.find(block.id).settings |
16 | 16 | end |
17 | + | |
18 | + | |
19 | + should 'access owner through box' do | |
20 | + user = create_user('testinguser').person | |
21 | + | |
22 | + box = Box.create!(:owner => user) | |
23 | + | |
24 | + block = Block.new | |
25 | + block.box = box | |
26 | + block.save! | |
27 | + | |
28 | + assert_equal user, block.owner | |
29 | + end | |
30 | + | |
31 | + should 'have no owner when there is no box' do | |
32 | + assert_nil Block.new.owner | |
33 | + end | |
17 | 34 | |
18 | 35 | end | ... | ... |