Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specs don't test anything of significance #2

Open
tehpeh opened this issue Aug 22, 2017 · 0 comments
Open

Specs don't test anything of significance #2

tehpeh opened this issue Aug 22, 2017 · 0 comments

Comments

@tehpeh
Copy link

tehpeh commented Aug 22, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant