Commit 62f8977239fbdc699d4f6e008edc05844f18d405
1 parent
789dc2c9
Exists in
web_steps_improvements
and in
9 other branches
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,7 +44,7 @@ class ManageProductsHelperTest < ActionView::TestCase | ||
44 | end | 44 | end |
45 | 45 | ||
46 | should 'display link to edit product when user has permission' do | 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 | user.expects(:has_permission?).with(anything, anything).returns(true) | 48 | user.expects(:has_permission?).with(anything, anything).returns(true) |
49 | @controller = mock | 49 | @controller = mock |
50 | @controller.expects(:user).returns(user).at_least_once | 50 | @controller.expects(:user).returns(user).at_least_once |
@@ -58,7 +58,7 @@ class ManageProductsHelperTest < ActionView::TestCase | @@ -58,7 +58,7 @@ class ManageProductsHelperTest < ActionView::TestCase | ||
58 | end | 58 | end |
59 | 59 | ||
60 | should 'not display link to edit product category when user does not have permission' do | 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 | user.expects(:has_permission?).with(anything, anything).returns(false) | 62 | user.expects(:has_permission?).with(anything, anything).returns(false) |
63 | @controller = mock | 63 | @controller = mock |
64 | @controller.expects(:user).returns(user).at_least_once | 64 | @controller.expects(:user).returns(user).at_least_once |
@@ -69,7 +69,7 @@ class ManageProductsHelperTest < ActionView::TestCase | @@ -69,7 +69,7 @@ class ManageProductsHelperTest < ActionView::TestCase | ||
69 | end | 69 | end |
70 | 70 | ||
71 | should 'display link to edit product category when user has permission' do | 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 | user.expects(:has_permission?).with(anything, anything).returns(true) | 73 | user.expects(:has_permission?).with(anything, anything).returns(true) |
74 | @controller = mock | 74 | @controller = mock |
75 | @controller.expects(:user).returns(user).at_least_once | 75 | @controller.expects(:user).returns(user).at_least_once |
@@ -83,7 +83,7 @@ class ManageProductsHelperTest < ActionView::TestCase | @@ -83,7 +83,7 @@ class ManageProductsHelperTest < ActionView::TestCase | ||
83 | end | 83 | end |
84 | 84 | ||
85 | should 'not display ui_button to edit product when user does not have permission' do | 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 | user.expects(:has_permission?).with(anything, anything).returns(false) | 87 | user.expects(:has_permission?).with(anything, anything).returns(false) |
88 | @controller = mock | 88 | @controller = mock |
89 | @controller.expects(:user).returns(user).at_least_once | 89 | @controller.expects(:user).returns(user).at_least_once |
@@ -94,7 +94,7 @@ class ManageProductsHelperTest < ActionView::TestCase | @@ -94,7 +94,7 @@ class ManageProductsHelperTest < ActionView::TestCase | ||
94 | end | 94 | end |
95 | 95 | ||
96 | should 'display ui_button_to_remote to edit product when user has permission' do | 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 | user.expects(:has_permission?).with(anything, anything).returns(true) | 98 | user.expects(:has_permission?).with(anything, anything).returns(true) |
99 | @controller = mock | 99 | @controller = mock |
100 | @controller.expects(:user).returns(user).at_least_once | 100 | @controller.expects(:user).returns(user).at_least_once |
@@ -109,7 +109,7 @@ class ManageProductsHelperTest < ActionView::TestCase | @@ -109,7 +109,7 @@ class ManageProductsHelperTest < ActionView::TestCase | ||
109 | 109 | ||
110 | 110 | ||
111 | should 'display ui_button to edit product when user has permission' do | 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 | user.expects(:has_permission?).with(anything, anything).returns(true) | 113 | user.expects(:has_permission?).with(anything, anything).returns(true) |
114 | @controller = mock | 114 | @controller = mock |
115 | @controller.expects(:user).returns(user).at_least_once | 115 | @controller.expects(:user).returns(user).at_least_once |