Class: Config::CreateTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/test/config/create_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



4
5
6
7
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/create_test.rb', line 4

def setup
  @config = ActiveScaffold::Config::Core.new :model_stub
  @default_link = @config.create.link
end

#teardownObject



9
10
11
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/create_test.rb', line 9

def teardown
  @config.create.link = @default_link
end

#test_default_optionsObject



13
14
15
16
17
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/create_test.rb', line 13

def test_default_options
  assert !@config.create.persistent
  assert !@config.create.edit_after_create
  assert_equal 'Create Model Stub', @config.create.label
end

#test_edit_after_createObject



51
52
53
54
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/create_test.rb', line 51

def test_edit_after_create
  @config.create.edit_after_create = true
  assert @config.create.edit_after_create
end

#test_labelObject



40
41
42
43
44
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/create_test.rb', line 40

def test_label
  label = 'create new monkeys'
  @config.create.label = label
  assert_equal label, @config.create.label
end


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/create_test.rb', line 19

def test_link_defaults
  link = @config.create.link
  assert !link.page?
  assert !link.popup?
  assert !link.confirm?
  assert_equal "new", link.action
  assert_equal "Create New", link.label
  assert link.inline?
  blank = {}
  assert_equal blank, link.html_options
  assert_equal :get, link.method
  assert_equal :table, link.type
  assert_equal :create, link.crud_type
  assert_equal :create_authorized?, link.security_method
end

#test_persistentObject



46
47
48
49
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/create_test.rb', line 46

def test_persistent
  @config.create.persistent = true
  assert @config.create.persistent
end


35
36
37
38
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/config/create_test.rb', line 35

def test_setting_link
  @config.create.link = ActiveScaffold::DataStructures::ActionLink.new('update', :label => 'Monkeys')
  assert_not_equal(@default_link, @config.create.link)
end