Class: HelloWorldServiceTest

Inherits:
Minitest::Test
  • Object
show all
Defined in:
minitest/hello_world_service_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject

Called before every test method runs. Can be used to set up fixture information.


11
12
13
14
15
16
17
# File 'minitest/hello_world_service_test.rb', line 11

def setup
  @upchan  = Rapid::Model::DummyUpdateChannel.new
  @root    = Rapid::Model::HashModelObject.new(:foo)
  @view    = Rapid::Model::View.new(@root, @root)
  @env     = Rapid::Services::Environment.new(nil, @upchan, @view)
  @service = Rapid::Examples::HelloWorldService.new(@env)
end

#teardownObject

Called after every test method runs. Can be used to tear down fixture information.


21
22
23
# File 'minitest/hello_world_service_test.rb', line 21

def teardown
  # Do nothing
end

#test_default_messageObject

Tests to see if the default message is 'Hello, world!'


26
27
28
29
30
# File 'minitest/hello_world_service_test.rb', line 26

def test_default_message
  @service.run

  assert_equal 'Hello, World!', @env.find('/message').value
end

#test_messageObject

Tests #message, to see if overriding the message works


33
34
35
36
37
38
# File 'minitest/hello_world_service_test.rb', line 33

def test_message
  @service.message('test message')
  @service.run

  assert_equal 'test message', @env.find('/message').value
end