view · edit · sidebar · attach · print · history

< Niklaus.20161207-davaz-rack | Index | Niklaus.20161205-consider-ut >>





Make running under Rack

Working on the failing test for the shop. Here I had to fix an error in get_session_id. No the tests fail, because the setup does not start with a new session_id. Therefore the items have leftover choices from the tests before. This must be corrected. May first idea to for the value of the cookie _session_id to a new value, had not the desired effect. Manually add a method to clear all fields and called it where appropriate. Pushed commit Shop test give now sensible errors.

There is an error, where the text Please fill out the fields that are marked with red. does not appear, but the postal code is marked red. Should I attack this error or the error when submitting the stock? Where I get a long stack trace containing the lines

NoMethodError at /en/communication
undefined method `each' for nil:NilClass
 Ruby /home/niklaus/git/ in send_order, line 97

Setting a pry debug on this line show that all the other information was passed correctyl

[1] pry(#<DaVaz::State::Communication::Shop>)> hash
=> {:name=>"TestName", :surname=>"TestSurname", :street=>"TestStreet", :postal_code=>"8888", :city=>"TestCity", :country=>"TestCountry", :email=>"", :article=>nil}

Why are the articles not handled correctly, too? Looks like in lib/sbsm/session.rb import_user_input the value of the article is not considered valid, even when we use the DaVaz::Util::Validator. Here the relevant pry output

[5] pry(#<DaVaz::Util::Session>)> valid = @validator.validate(key, value)
=> nil
[6] pry(#<DaVaz::Util::Session>)> @validator.class
=> DaVaz::Util::Validator
[7] pry(#<DaVaz::Util::Session>)> key
=> :article
[9] pry(#<DaVaz::Util::Session>)> value
=> {"111"=>"", "112"=>"", "113"=>"2", "114"=>"2", "115"=>""}
[10] pry(#<DaVaz::Util::Session>)> value.class
=> Hash

Added a new unit test test/validator_test.rb, which fails, as expected. Debugging the problem. As the Davaz-Validator does not have a validate method, the error must lie in the sbsb/validator class. The Davaz-Validator class has EVENTS containing article and ajax_article.

SBSM has a test_hash where we have a function test_user_input_hash, which results in a rack request

=> {"hash[1]"=>"4", "hash[2]"=>"5", "hash[3]"=>"6"}
whereas in out case we receive
=> {"zone"=>"communication",
 "article"=>{"111"=>"", "112"=>"", "113"=>"2", "114"=>"2", "115"=>""},
 "order_item"=>"Order item(s)",

Should the article parameter look like {article['111'] => , article['112'] => , article['113'] => '2', article['114'] => '2, 'article['115'] => ''}?

Somehow hash parameter are not stored/retrieved correctly from the POST parameters. And my test test_user_input_hash added in sbsm/test/test_session.rb is not correct.

Fixed this problem, now looking at the remaining error I introduced when upgrading to the new mail gem. Fixed this problem too. Sending the test-email worked, after I added new field test_delivery to the Mailer config, as it is sent in a separate process from the shop_test.

When running rake test I have much more problems (3 failures, 18 errors) compared to running individual ruby test/features/<x>_test.rb. But some problems persist. Also discovered that after some failures the process continues to run for seconds after the test finished.

Pushed commit Fixed handling hashes from POST requests and Fixed send e-mail as confirmation of shop order

After activating the two commits above on oddb-ci2 under /var/www/ I get the following error

NoMethodError at /
undefined method `[]' for #<Yus::Server:0x0000000252dd00>

Somehow the proxy is used here in unexpected way. No. It was just the MySQL server which was not yet started.

Manually tested the mouseover and found for :

  • Moving to the head it display the picture and text of 21th century museum
  • biggest of three clouds: Shows the same picture and text
  • smallest cloud: display at the bottom the link to en/personal/inspiration

Under en/personal/inspiration going to the blue marked links shows the pictures. Some with en/personal/the_family.

When entering 'b' as Postal Code and pressing "Order items(s)" the Postal Code (and other stuff) is marked red AND the remark "Please fill out the fields that are marked with red." is displayed.

But clicking on the logout button an empty page is displayed for, whereas on I am redirected correctly to

view · edit · sidebar · attach · print · history
Page last modified on December 06, 2016, at 05:25 PM