SergheiScepanovschi / ruby_on_rails_rep

0 stars 2 forks source link

Updated as requrement #4

Closed SergheiScepanovschi closed 3 years ago

SergheiScepanovschi commented 3 years ago

pull request for comments

SergheiScepanovschi commented 3 years ago

Здравствуйте

Я получил следующие требования к заданию: "You need to save 2 HTML files accounts.html and transactions.html and cover with specs methods for parse accounts and parse transactions.". Но такой тест сделать не представляется возможным так как страница со списком транзакций не содержит всех деталей и парсить её бессмысленно. Мой метод parse_transaction работает только на странице с деталями транзакций. Поэтоме я сохранил 10 страниц с деталями транзакций и парсю их по очереди. Пожалуйста проверьте результаты.

Всего наилучшего, Сергей

ср, 7 окт. 2020 г. в 11:53, Turcanuse notifications@github.com:

@Turcanuse commented on this pull request.

In getDateFromBancAccaunt/account_spec.rb https://github.com/SergheiScepanovschi/ruby_on_rails_rep/pull/4#discussion_r500846088 :

+ +require_relative 'example_bank' +require 'rspec' +str = IO.read("temp.json") +my_hash = JSON.parse(str) +accounts = [] +my_hash['account'].each do |item|

  • accounts << Account.new(
  • item['name'],
  • item['currency'],
  • item['balance'].to_f,
  • item['nature']
  • ) +end +example_bank = ExampleBank.new +describe 'accounts' do

Refactor spec. You need to save 2 HTML files accounts.html and transactions.html and cover with specs methods for parse accounts and parse transactions. You should show in spec:

  1. Count of accounts expect(accounts.count).to eq(5)
  2. Count of transactions expect(transactions.count).to eq(10)
  3. Example of one account in hash format (check again example)

expect(accounts.first.to_hash).to eq( {

"name" => "Demo Everyday Account", "currency" => "USD", "balance" => 1959.90, "nature" => "account", "transactions" => [] }

)

  1. Example of one transaction in hash format (check my example).

expect(transactions.first.to_hash).to eq( { "date": "2020-10-07", "description": "bought food", "amount": -89.31, "currency": "USD", "account_name": "Demo Everyday Account" } )

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SergheiScepanovschi/ruby_on_rails_rep/pull/4#pullrequestreview-503660843, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANJ6XU3XHDUX655DACUILCTSJQT7NANCNFSM4SFYV5PA .