Sha256: 1f1eb1a379bc1b47652380cd58d4c5120531f01c184558029bfb891b6e53e08d

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require 'assert'

module Sanford::Runner

  class BaseTests < Assert::Context
    desc "Sanford::Runner"
    setup do
      request = Sanford::Protocol::Request.new('test', {})
      @runner = Sanford::DefaultRunner.new(BasicServiceHandler, request)
    end
    subject{ @runner }

    should have_instance_methods :handler_class, :request, :logger, :run
    should have_class_methods :run

    should "run the handler and return the response it generates when `run` is called" do
      response = subject.run

      assert_instance_of Sanford::Protocol::Response, response
      assert_equal 200,                     response.code
      assert_equal 'Joe Test',              response.data['name']
      assert_equal 'joe.test@example.com',  response.data['email']
    end

    should "be able to build a runner with a handler class and params" do
      response = nil
      assert_nothing_raised do
        response = Sanford::DefaultRunner.run(BasicServiceHandler, {})
      end

      assert_equal 200, response.code
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sanford-0.8.0 test/unit/runner_tests.rb