Class: ActionLinkTest

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

Instance Method Summary collapse

Instance Method Details

#setupObject



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

def setup
  @link = ActiveScaffold::DataStructures::ActionLink.new('foo')
end

#test_positionObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/action_link_test.rb', line 41

def test_position
  @link.position = true

  @link.type = :table
  assert_equal :top, @link.position

  @link.type = :record
  assert_equal :replace, @link.position

  @link.position = :before
  assert_equal :before, @link.position

  @link.position = false
  assert_equal false, @link.position
end

#test_presentation_styleObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/action_link_test.rb', line 57

def test_presentation_style
  # default
  assert @link.inline?
  assert !@link.popup?
  assert !@link.page?

  @link.popup = true
  assert !@link.inline?
  assert @link.popup?
  assert !@link.page?

  @link.page = true
  assert !@link.inline?
  assert !@link.popup?
  assert @link.page?

  @link.inline = true
  assert @link.inline?
  assert !@link.popup?
  assert !@link.page?
end

#test_simple_attributesObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/action_link_test.rb', line 8

def test_simple_attributes
  assert_equal 'foo', @link.action
  @link.action = 'bar'
  assert_equal 'bar', @link.action

  hash = {:a => :b}
  @link.parameters = hash
  assert_equal hash, @link.parameters

  @link.label = 'hello world'
  assert_equal 'hello world', @link.label

  assert !@link.confirm
  @link.confirm = true
  assert @link.confirm

  @link.label = 'Hello World'
  assert_equal 'hello_world_authorized?', @link.security_method
  @link.label = 'HelloWorld'
  assert_equal 'hello_world_authorized?', @link.security_method
  @link.security_method = 'blueberry_pie'
  assert_equal 'blueberry_pie', @link.security_method

  @link.type = :table
  assert_equal :table, @link.type
  @link.type = :record
  assert_equal :record, @link.type

  assert_equal :get, @link.method
  @link.method = :put
  assert_equal :put, @link.method
end