Skip to content

Specs don't test anything of significance #2

Description

@tehpeh

Firstly, in connection/*_spec.rb setting up a stubbed response with:

Excon.stub({:method => :post}) do |params|
case params[:path]
when UPS::Connection::SHIP_CONFIRM_PATH
{body: File.read("#{stub_path}/ship_confirm_success.xml"), status: 200}
when UPS::Connection::SHIP_ACCEPT_PATH
{body: File.read("#{stub_path}/ship_accept_success.xml"), status: 200}
end
end

just matches on the request URL path, then returns a canned response. The specs just check against what was in the canned response.

In effect they're only testing the response parsing, instead of the request. Is this ok?

Second, the XML schema validation:

def test_validates_against_xsd
assert_passes_validation schema_path('ShipConfirmRequest.xsd'), @ship_confirm_builder.to_xml
end

appears to me to do nothing. Mutilating the XML that is generated in the builders results in no failure. How is this supposed to work?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions