balanced / balanced-api

Balanced API specification.
220 stars 72 forks source link

Regression spec for #572 #573

Closed steveklabnik closed 9 years ago

steveklabnik commented 10 years ago

Fixes #572

steveklabnik commented 10 years ago

@mjallday seems that https://github.com/balanced/balanced-api/blob/master/features/credit_cards.feature#L404-L407 regressed?

This actually passed for me locally, so I'm not sure I can trust this result :/. Re-trying Travis.

matthewfl commented 10 years ago

I think that the issue here was that the card would end up getting lost after 2 hours, since that is the time limit that we essentially give to associate the card to the marketplace. Unless you have this test running for 2 hours I doubt that you are going to see it.

Also, I believe that this was fix so you should see this behaviour anymore

steveklabnik commented 10 years ago

Right, but as @mahmoudimus pointed out, we should have the behavior specced out so that we don't regress.

That said, yes, if it takes two hours, well...

mjallday commented 10 years ago

@matthewfl looks like he's pointing out a test for indexing deleted cards.

the card would expire after 2 hours and give you a 404 when doing cards.show, however, if it wasn't claimed correctly it would never show in the index regardless of expiration.

matthewfl commented 10 years ago

@mjallday o, it just looked like an association test.

steveklabnik commented 10 years ago

Yes, the new test is an association test, the failing test is a 'deleted card' spec.

mjallday commented 10 years ago
(::) failed steps (::)
Failed assertion, no message given. (MiniTest::Assertion)
./features/step_definitions/cards.rb:93:in `block (2 levels) in <top (required)>'
./features/step_definitions/cards.rb:92:in `each'
./features/step_definitions/cards.rb:92:in `/^I should not see that card in the results$/'
features/credit_cards.feature:407:in `Then I should not see that card in the results'
Unable to get a dispute in 3 minutes (RuntimeError)
./features/step_definitions/disputes.rb:35:in `/^I have a dispute$/'
features/rest/disputes.feature:4:in `Given I have a dispute'
Unable to get a dispute in 3 minutes (RuntimeError)
./features/step_definitions/disputes.rb:35:in `/^I have a dispute$/'
features/rest/disputes.feature:10:in `Given I have a dispute'
Failing Scenarios:
cucumber features/credit_cards.feature:404 # Scenario: Unstored cards aren't visible from the index
cucumber features/rest/disputes.feature:3 # Scenario: Retrieve a dispute
cucumber features/rest/disputes.feature:9 # Scenario: List disputes

I won't comment on the dispute tests but for the deleted card test:

curl https://api.balancedpayments.com/cards -H "Accept: application/vnd.api+json;revision=1.1" -u ak-test-1PPfI4CmXSaOHFgIYzWdA5fpdkYe9mvLL: -d "expiration_month=12" -d "cvv=123" -d "number=5105105105105100" -d "expiration_year=2020"
{
  "cards": [
    {
      "cvv_match": "yes",
      "links": {
        "customer": null
      },
      "name": null,
      "expiration_year": 2020,
      "avs_street_match": null,
      "is_verified": true,
      "created_at": "2014-04-22T20:45:32.614628Z",
      "cvv_result": "Match",
      "brand": "MasterCard",
      "number": "xxxxxxxxxxxx5100",
      "updated_at": "2014-04-22T20:45:32.614630Z",
      "id": "CCgM7SGK70cPhjxORUPGUKx",
      "expiration_month": 12,
      "cvv": "xxx",
      "meta": {},
      "href": "/cards/CCgM7SGK70cPhjxORUPGUKx",
      "address": {
        "city": null,
        "line2": null,
        "line1": null,
        "state": null,
        "postal_code": null,
        "country_code": null
      },
      "fingerprint": "fc4ccd5de54f42a5e75f76fbfde60948440c7a382ee7d21b2bc509ab9cfed788",
      "avs_postal_match": null,
      "avs_result": null
    }
  ],
  "links": {
    "cards.card_holds": "/cards/{cards.id}/card_holds",
    "cards.customer": "/customers/{cards.customer}",
    "cards.debits": "/cards/{cards.id}/debits"
  }
}
curl https://api.balancedpayments.com/cards/CCgM7SGK70cPhjxORUPGUKx      -H "Accept: application/vnd.api+json;revision=1.1"      -u ak-test-1PPfI4CmXSaOHFgIYzWdA5fpdkYe9mvLL: -XDELETE
curl https://api.balancedpayments.com/cards      -H "Accept: application/vnd.api+json;revision=1.1"      -u ak-test-1PPfI4CmXSaOHFgIYzWdA5fpdkYe9mvLL: | grep CCgM7SGK70cPhjxORUPGUKx

Gives no results (expected)

Not sure how that test is failing for you.

steveklabnik commented 10 years ago

Ugh. It's working for me locally too. I wonder why not on Travis... time to turn on debugging and run it a few more times, i guess.

matthewfl commented 10 years ago

@steveklabnik are you using the office ip when you test? Sometimes there are different configs set as others are working on the stack. You might try testing from an "random" ip such as a vps

steveklabnik commented 10 years ago

I am testing from a VPS.

remear commented 10 years ago

Updates?

steveklabnik commented 10 years ago

@remear still blocking on https://github.com/balanced/balanced-api/issues/591 , it's the same failure

remear commented 9 years ago

This needs to be rebased.