Resolves failing test `spec/features/versions_spec.rb:344`:
1) Version display changes in users_role for conference role
Failure/Error: expect(page).to have_text("added role cfp with ID #{user_role.id} to user #{user.name} in conference #{conference.short_title}")
expected to find text "added role cfp with ID 2 to user name2 in conference fr_GAQ" in "OSEM\nname1\nAll Conferences\nOrganizations\nRevision History\nAll Conferences\nRevision History\nLog of changes made to conferences and associated resources\nShow\n10\n25\n50\n100\nAll\nentries\nSearch:\nID Description Actions\n18\nname2 signed up less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n17\nSomeone (probably via the console) updated is admin of user name1 less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n16\nname1 signed up less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n15\nSomeone (probably via the console) created new cfp for events in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n14\nSomeone (probably via the console) created new role volunteers_coordinator in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n13\nSomeone (probably via the console) created new role info_desk in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n12\nSomeone (probably via the console) created new role cfp in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n11\nSomeone (probably via the console) created new role organizer in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n10\nSomeone (probably via the console) created new difficulty level Hard in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n9\nSomeone (probably via the console) created new difficulty level Medium in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\nShowing 1 to 10 of 16 entries\nFirst\nPrevious\n1\n2\nNext\nLast\nThis tool is free software, released under the MIT license. You can run, copy, distribute, study, change and improve it. The source code and the developers are on GitHub."
# ./spec/features/versions_spec.rb:350:in `block (2 levels) in <top (required)>'
As of Rails 5.1:
- Rails has built-in support for running tests within database
transactions, so Database Cleaner is no longer needed for this.
- Rails automatically shares the database connection across threads,
so transactional_capybara is no longer needed.
Changes:
- Enable `use_transactional_tests`.
- Remove transactional_capybara.
- Remove the Database Cleaner test wrapper.
This resolves:
- transactional_capybara mismanages the shared database connection,
causing the connection to falsely report as idle after the first
test. At 6 minutes (idle_timeout + reaping_frequency) into testing,
the connection is closed, causing e.g. `PG::ConnectionBad` errors.
The single query was producing a tremendously large ActiveRecord allocation.
While this isn't nearly as cool as one query, it's still a significant
reduction in SQL trips, and now has the bonus of only loading what is
actually going to be displayed.
Update config with rails app:update
Update schema.rb rails db:migrate
Add puma
Make jobs and models inherit from ApplicationJob and ApplicationRecord
Update acts_as_list to 0.9.7 in order to fix
"undefined method `sanitize_sql_hash_for_conditions'" error
Update web-console to 2.3.0 to fix a 500 internal server error
Replace before_filter with before_action
Add rails-controller-testing gem
Add prepend: :true to protect_from_forgery in ApplicationController to
avoid ActionController::InvalidAuthenticityToken exceptions
Remove activeuuid
Update formtastic to 3.1.5 to fix deprecation warnings and issues
with the Input class
Update ahoy_matey to 1.6.0
Update cancancan to 2.0.0 to fix issues with malformed sql queries
Fix program spec
Fix issue with the picture being nil in admin/Organizations#new and #edit
and Organizations#show
Fix ActiveRecord::Base.raise_in_transactional_callbacks= deprecation
warning by removing an unnecessary line in application.rb
Fix failing versions specs
Use load_and_authorize_resource in versions controlller
Add conference specifc route to revision history page
Users with role can view revision_history only for the versions they have access to
Handle versions where conference_id is not set (records before papertrail was introduced)
We are using `paper_trail` gem, which saves data in database table
versions. It has a native way to search in the versions records,
using `where_object()` and `where_object_changes()`. They are broken,
under certain conditions. We changed them to a manual `where()`.
To test this case we need: an Event with ID 1, an Event with ID 2, and
a commercial with ID 1, for event with ID 2 - obviously the numbers
could be different as long as there is this matching of IDs. Before
this was made wit ha expect, which would make the test fail if this is
not the case. But this is actually the test case, not what we want to
test, so I moved to the `let`.
This was also the case why one of the test was broken after we change
how the database is cleaned in:
https://github.com/openSUSE/osem/pull/1541
I also remove the feature test, as this should be tested in a
controller test.
There is a known issue in paper_trail that whenever we Query the
'versions.object' column it evaluates inconsistent results for numeric
values due to limitations of SQL wildcard matchers against the
serialized objects. So to fix this issue I have manually formed the where
query instead of using where_object and where_object_changes. I have
also added test for the same.
Fixes#1307