view · edit · sidebar · attach · print · history

< Niklaus.20161122-davaz-rack | Index | Niklaus.20161116-davaz-rack >>

20161121-davaz-rack

Summary

Commits

Index

Convert davaz.com to use SBSM 1.3.1 with rack

Must solve the following problems:

  • Fix displaying animated gif
  • Fix test for sending an e-mail in shop
  • Fix displaying pager items in shop
  • Fix running on travis-ci

Configured SBSM::Logging for unit test early via SBSM.logger= ChronoLogger.new(DaVaz.config.log_pattern) in test/support/test_case.rb. The YUS-Server is no longer properly initialized when running unit tests. Why? Must introduce a config variable yus_server for the test. Now the test work locally, but does not stop correctly the davaz-app and rack server. Fixed this problem with commits Fix yus-server when running tests and Use mail gem

Now working on the unit test for shopping where we deliver an e-mail. Found out that the sum is not updated correctly in when using the stub/db_manager.

Also remarked that the validator does accept articles (which is a hash) as user_input, whereas other fields like e-mail, name, were processed correctly. Somehow we don't handle hashes correctly. After merging the rack.request.form_hash into the hash for import_user_input my new unit test passed. But this did not fix the real problem.

Digging deeper I see that I did not handle the post parameter correctly. I must consider the Rack::Request env parameter 'rack.request.form_vars', too. They can be found via rack_req.POST, too. But must fix first the problem, that the total of order is not updated after entering a number and pressing TAB. This should result in a HTTP get for GET /en/communication/ajax_shop/artobject_id/1616/count/2

This get request gets stuck with an error, which is not displayed, but which can be in the console output

Checking count -> 2  valid "2" index nil
NoMethodError: private method `select' called for nil:NilClass
        /var/www/davaz.com/src/state/communication/shop.rb:21:in `init'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:381:in `process'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:175:in `block in drb_process'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:174:in `synchronize'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:174:in `drb_process'
        /usr/local/lib/ruby/2.3.0/drb/drb.rb:1137:in `method_missing'
        /home/niklaus/git/sbsm/lib/sbsm/app.rb:105:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:49:in `_call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:37:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/content_length.rb:15:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/static.rb:149:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/common_logger.rb:33:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/tempfile_reaper.rb:15:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:49:in `_call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:37:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/common_logger.rb:33:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/chunked.rb:54:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/content_length.rb:15:in `call'
        /var/www/davaz.com/vendor/ruby/2.3.0/gems/rack-2.0.1/lib/rack/handler/webrick.rb:86:in `service'
        /usr/local/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
        /usr/local/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'

Also remarked that US$ and Euro-Prices for each items are all 0. Problem is that the cookie :remember via persistent_user_input is not set correctly.

Saved html output from davaz.com after selecting one, then two shopping items. Difference for

  • GET /en/communication/ajax_shop/artobject_id/1048/count/2 to
  • GET /en/communication/ajax_shop/artobject_id/1046/count/2 is
<td>2</td>
<td>&nbsp;x&nbsp;</td>
<td class="shopping-cart-title">Drawings</td>
<td>&nbsp;&aacute;&nbsp;</td>
<td>CHF 100.-</td>
<td>&nbsp;=&nbsp;</td>
<td class="shopping-cart-subtotal">CHF 200.-</td>
<td><a name="remove_item" href="javascript:void(0)" onclick="removeFromShoppingCart('http://davaz.com/en/communication/ajax_shop/artobject_id/1046/count/0', 'article[1046]');
">Remove item</a></td>
</tr>
<tr>

Tomorrow I will try to see what exactly was generated when using rack and not mod_ruby.

view · edit · sidebar · attach · print · history
Page last modified on November 21, 2016, at 05:42 PM