Class: MenuItemTest
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- MenuItemTest
show all
- Includes:
- Goldberg::TestHelper
- Defined in:
- lib/six-updater-web/vendor/plugins/goldberg/test/unit/menu_item_test.rb
Instance Method Summary
collapse
#form_login, #form_logout, included, #login_user
Instance Method Details
#test_must_have_content_page_or_controller_action ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/test/unit/menu_item_test.rb', line 38
def test_must_have_content_page_or_controller_action
mi = Goldberg::MenuItem.new(:name => 'test', :label => 'Test')
assert(!mi.valid?)
assert(mi.errors.invalid?(:content_page_id))
assert(mi.errors.invalid?(:controller_action_id))
assert(!mi.save)
end
|
#test_name_is_required ⇒ Object
30
31
32
33
34
35
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/test/unit/menu_item_test.rb', line 30
def test_name_is_required
mi = Goldberg::MenuItem.new(:content_page_id => 1)
assert(!mi.valid?)
assert(mi.errors.invalid?(:name))
assert(!mi.save)
end
|
#test_name_is_unique ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/six-updater-web/vendor/plugins/goldberg/test/unit/menu_item_test.rb', line 6
def test_name_is_unique
name_1 = 'THIS_IS_NAME_1'
name_2 = 'THIS_IS_NAME_2'
name_1.freeze
name_2.freeze
= Goldberg::MenuItem.new(:content_page_id => 1)
= Goldberg::MenuItem.new(:content_page_id => 1)
.name = name_1
.label = 'This is name 1'
.name = name_2
.label = 'This is name 2'
assert(.save)
assert(.save)
.name = name_1
assert(!.save)
assert(.errors.invalid?(:name))
end
|