Sha256: ae43bf0b78d03dd6df5c300063d0ebe71080ad5acbd5dd9b49efb1bd53b59e8b

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'assert'
require 'deas-json/view_handler'

require 'deas/view_handler'

module Deas::Json::ViewHandler

  class UnitTests < Assert::Context
    desc "Deas::Json::ViewHandler"
    setup do
      @handler_class = TestJsonHandler
    end
    subject{ @handler_class }

    should "use much-plugin" do
      assert_includes MuchPlugin, Deas::Json::ViewHandler
    end

    should "be a deas view handler" do
      assert_includes Deas::ViewHandler, subject
    end

    should "override the default status and body values" do
      assert_equal 200,    subject.default_status
      assert_equal ['{}'], subject.default_body
    end

  end

  class InitTests < UnitTests
    include Deas::ViewHandler::TestHelpers

    desc "when init"
    setup do
      @runner  = test_runner(@handler_class)
      @handler = @runner.handler
    end
    subject{ @runner }

    should "force its content type to :json" do
      assert_equal '.json', subject.content_type_args.extname
      exp = { 'charset' => 'utf-8' }
      assert_equal exp, subject.content_type_args.params
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deas-json-0.3.5 test/unit/view_handler_tests.rb