vadim030303 / Test-Task

0 stars 0 forks source link

Update your code #1

Closed Stepandanci closed 4 years ago

Stepandanci commented 4 years ago

Hello,

You wrote a good test task!

Make your changes in another branch (example: dev) and open a new pull request to master branch.

I need to check parsing result from demo bank. Save JSON data with parsed accounts and transactions in a file.

You should write a test that checks the data from demo provider bendigo bank.

  1. Read about Rspec. It is a framework for test your code.
  1. Create bendigobank_spec.rb file, describe class BendigoBank.

  2. Write specs for parse_accounts and parse_transactions.

  3. Take HTML from bendigo bank and save it in a file (check screenshot). html_example = Nokogiri::HTML(File.read('accounts.html'))

Снимок

  1. Call method for parse accounts and send HTML data. parse_accounts(html_example)

  2. Check the number of accounts and show an example account in a hash format.

Example:

it 'check number of accounts and show an example account' do
  html_example = Nokogiri::HTML(File.read('accounts.html'))
  accounts = parse_accounts(html_example) # NOTE: It is my example, not a real code.

  expect(accounts.count).to eq(5)
  expect(accounts.first.to_hash).to eq(
    {
      "name"         => "Demo Everyday Account",
      "currency"     => "USD",
      "balance"      => 1959.90,
      "nature"       => "account",
      "transactions" => []
    }
  )
end
  1. Do the same for transactions.

Good luck!

vadim030303 commented 4 years ago

@Stepandanci I have created pull request, please review it.

Stepandanci commented 4 years ago

Looks very good! Your task is complete.

I will ask other developers to review it. Add folder /bin to .gitignore.