{"action":"opened","issue":{"url":"https://api.github.com/repos/lemonsweets/oystercard/issues/14","labels_url":"https://api.github.com/repos/lemonsweets/oystercard/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/lemonsweets/oystercard/issues/14/comments","events_url":"https://api.github.com/repos/lemonsweets/oystercard/issues/14/events","html_url":"https://github.com/lemonsweets/oystercard/issues/14","id":100750932,"number":14,"title":"minimum_balance.md","user":{"login":"lemonsweets","id":12461822,"avatar_url":"https://avatars.githubusercontent.com/u/12461822?v=3","gravatar_id":"","url":"https://api.github.com/users/lemonsweets","html_url":"https://github.com/lemonsweets","followers_url":"https://api.github.com/users/lemonsweets/followers","following_url":"https://api.github.com/users/lemonsweets/following{/other_user}","gists_url":"https://api.github.com/users/lemonsweets/gists{/gist_id}","starred_url":"https://api.github.com/users/lemonsweets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lemonsweets/subscriptions","organizations_url":"https://api.github.com/users/lemonsweets/orgs","repos_url":"https://api.github.com/users/lemonsweets/repos","events_url":"https://api.github.com/users/lemonsweets/events{/privacy}","received_events_url":"https://api.github.com/users/lemonsweets/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-13T11:55:02Z","updated_at":"2015-08-13T11:55:02Z","closed_at":null,"body":"You can now use the card to pay for a journey by deducting money from it. However, the the card is essentially bottomless: there's no check to see if the card has enough funds to pay. If you try to pay with it, it will gladly go into the negative balance. \n\nUpdate the `deduct` method to only allow it to deduct the money if enough funds are available. Like always, test-drive it by writing a failing test first and then implementing the functionality to make it pass.\n\n## Skills you will learn:\n- S171: Use an inline `if` statement\n- S173: Raise errors\n- S175: Check that a statement raises an error with RSpec\n\n## Interview questions you may expect:\n- I176: What are exceptions in Ruby? Why do they have messages associated with them?\n- I177: How can you check an expression raises an error with RSpec? Why do you have to pass the code as a block to do this?\n\n## To complete this challenge:\n- [ ] Write a failing test for the `deduct` method\n- [ ] Update the method to make the test pass\n\n## Suggested resources:\n- [Handling and Raising exceptions](https://rubymonk.com/learning/books/4-ruby-primer-ascent/chapters/41-exceptions/lessons/92-handling)\n- [raise_error matcher](https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/raise-error-matcher)\n- [expect vs expect with a block on SO](http://stackoverflow.com/questions/19960831/rspec-expect-vs-expect-with-block-whats-the-difference)"}}