Commit 62f8977239fbdc699d4f6e008edc05844f18d405

Authored by Joenio Costa
1 parent 789dc2c9

fix manage products unit:tests

it seems that a 'mock object' is false in a `if` block
Showing 1 changed file with 6 additions and 6 deletions   Show diff stats
test/unit/manage_products_helper_test.rb
... ... @@ -44,7 +44,7 @@ class ManageProductsHelperTest < ActionView::TestCase
44 44 end
45 45  
46 46 should 'display link to edit product when user has permission' do
47   - user = mock
  47 + user = User.new(:email => 'display-link@email.invalid.com')
48 48 user.expects(:has_permission?).with(anything, anything).returns(true)
49 49 @controller = mock
50 50 @controller.expects(:user).returns(user).at_least_once
... ... @@ -58,7 +58,7 @@ class ManageProductsHelperTest < ActionView::TestCase
58 58 end
59 59  
60 60 should 'not display link to edit product category when user does not have permission' do
61   - user = mock
  61 + user = User.new(:email => 'not-display-link@email.invalid.com')
62 62 user.expects(:has_permission?).with(anything, anything).returns(false)
63 63 @controller = mock
64 64 @controller.expects(:user).returns(user).at_least_once
... ... @@ -69,7 +69,7 @@ class ManageProductsHelperTest < ActionView::TestCase
69 69 end
70 70  
71 71 should 'display link to edit product category when user has permission' do
72   - user = mock
  72 + user = User.new(:email => 'display-link@email.invalid.com')
73 73 user.expects(:has_permission?).with(anything, anything).returns(true)
74 74 @controller = mock
75 75 @controller.expects(:user).returns(user).at_least_once
... ... @@ -83,7 +83,7 @@ class ManageProductsHelperTest < ActionView::TestCase
83 83 end
84 84  
85 85 should 'not display ui_button to edit product when user does not have permission' do
86   - user = mock
  86 + user = User.new(:email => 'not-display-uibutton@email.invalid.com')
87 87 user.expects(:has_permission?).with(anything, anything).returns(false)
88 88 @controller = mock
89 89 @controller.expects(:user).returns(user).at_least_once
... ... @@ -94,7 +94,7 @@ class ManageProductsHelperTest < ActionView::TestCase
94 94 end
95 95  
96 96 should 'display ui_button_to_remote to edit product when user has permission' do
97   - user = mock
  97 + user = User.new(:email => 'display-uibuttontoremote@email.invalid.com')
98 98 user.expects(:has_permission?).with(anything, anything).returns(true)
99 99 @controller = mock
100 100 @controller.expects(:user).returns(user).at_least_once
... ... @@ -109,7 +109,7 @@ class ManageProductsHelperTest < ActionView::TestCase
109 109  
110 110  
111 111 should 'display ui_button to edit product when user has permission' do
112   - user = mock
  112 + user = User.new(:email => 'display-uibutton@email.invalid.com')
113 113 user.expects(:has_permission?).with(anything, anything).returns(true)
114 114 @controller = mock
115 115 @controller.expects(:user).returns(user).at_least_once
... ...