Session and App are not clearly separated. Must think harder on howto seperate them.
Also I must add unit-tests for all occurrences of self::class in lib/sbsm. There are already test which set DIRECT_EVENT, EVENTS, EVENT_MAP, VOLATILE, DATES, but not for VALIDATOR.
While working on creating the customized test app, remarked that login is defined twice in davaz.com in the session and app.
Resolved all unit tests around the constant from session. But I have still 4 failing test in test/test_session.rb. But here I sometimes have to update the setup of tests. E.g. I had to add a Stub for the SBSM::App with the lines
class StubSessionApp < SBSM::App attr_accessor :trans_handler, :validator SESSION = StubSessionSession def initialize super(session_class: StubSessionSession, validator: StubSessionValidator.new, unknown_user: StubSessionUnknownUser.new ) end def login(session) false end def async(&block) block.call end end
or replace calls to
session.process_rack(:rack_request =>req2). Or
session = StubSessionSession.new("test", StubSessionApp.new) had to be replaces by
session = StubSessionSession.new(app: StubSessionApp.new)
This are changes in the interface which I documented in History.txt (not yet pushed).
Added nice test to check howto initialize an SBSM::App and verifying that trans_handler, validator, cookie_name, etc get correctly initialize. Now I still have 10 failing unit test and must fix my code.
Also moved some tests, eg. http_header from test/test_session.rb -> test/test_customized_app.rb. Same for test_process, which evaluates the active_state. Made observable by saving a copy of the last session in app.rb. As I changed the test, I am unsure now whether after visiting about, then feedback I should reach Demo::FeedbackState or Demo::AboutState.
Now I am down to the following two error
1) Failure: AppTest#test_session_id_is_maintained [/home/niklaus/git/sbsm/test/test_application.rb:152]: Expected /member_counter is 1$/ to match "member_counter is 2". 2) Failure: CustomizedAppSessionValidatorLnf#test_process_state [/home/niklaus/git/sbsm/test/test_customized_app.rb:206]: Expected: Demo::FeedbackState Actual: Demo::AboutState
Davaz.com does not work locally, as I must change the initialization a little bit. I had no time to make it work completly. Login Works, but not logout.
Pushed commit Improved unit test for constants from SBSM::Session.