Sha256: 7f522eaa05476c2b314e2b0f8afa698728d242038559b9adab86621bb2aa2db7

Contents?: true

Size: 1.47 KB

Versions: 4

Compression:

Stored size: 1.47 KB

Contents

require 'assert'
require 'deas/request_data'

class Deas::RequestData

  class UnitTests < Assert::Context
    desc "Deas::RequestData"
    setup do
      @request    = Factory.string
      @response   = Factory.string
      @params     = Factory.string
      @route_path = Factory.string

      @request_data = Deas::RequestData.new({
        :request    => @request,
        :response   => @response,
        :params     => @params,
        :route_path => @route_path
      })
    end
    subject{ @request_data }

    should have_readers :request, :response, :params, :route_path

    should "know its attributes" do
      assert_equal @request,    subject.request
      assert_equal @response,   subject.response
      assert_equal @params,     subject.params
      assert_equal @route_path, subject.route_path
    end

    should "default its attributes when they aren't provided" do
      request_data = Deas::RequestData.new({})

      assert_nil request_data.request
      assert_nil request_data.response
      assert_nil request_data.params
      assert_nil request_data.route_path
    end

    should "know if it is equal to another request data" do
      request_data = Deas::RequestData.new({
        :request    => @request,
        :response   => @response,
        :params     => @params,
        :route_path => @route_path
      })
      assert_equal request_data, subject

      request_data = Deas::RequestData.new({})
      assert_not_equal request_data, subject
    end


  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
deas-0.43.3 test/unit/request_data_tests.rb
deas-0.43.2 test/unit/request_data_tests.rb
deas-0.43.1 test/unit/request_data_tests.rb
deas-0.43.0 test/unit/request_data_tests.rb