Class: ODDB::View::User::TestPowerLink

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
test/test_view/user/powerlink.rb

Defined Under Namespace

Classes: StubModel, StubSession

Instance Method Summary (collapse)

Instance Method Details

- (Object) setup



22
23
24
25
26
# File 'test/test_view/user/powerlink.rb', line 22

def setup
  @model = StubModel.new
  @session = StubSession.new
  @powerlink = View::User::PowerLink.new(@model, @session)
end

- (Object) test_http_headers



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'test/test_view/user/powerlink.rb', line 31

def test_http_headers
  expected = {
    "Location" => nil,
  }
  assert_equal(expected, @powerlink.http_headers)
  @model.powerlink = "http://www.ywesee.com"
  expected = {
    "Location" => "http://www.ywesee.com"
  }
  assert_equal(expected, @powerlink.http_headers)
  @model.powerlink = "www.ywesee.com"
  assert_equal(expected, @powerlink.http_headers)
  @model.powerlink = "https://www.ywesee.com"
  expected = {
    "Location" => "https://www.ywesee.com"
  }
  assert_equal(expected, @powerlink.http_headers)
end

- (Object) test_interface



27
28
29
30
# File 'test/test_view/user/powerlink.rb', line 27

def test_interface
  assert_respond_to(@powerlink, :http_headers)
  assert_respond_to(@powerlink, :to_html)
end