Skip to content

Commit

Permalink
Pin mongoid-locker to 2.0.0
Browse files Browse the repository at this point in the history
The front-office and back-office apps when the engine has been bumped have also taken on the latest version of mongoid-locker (v2.0.1) because it was not pinned.

Though only a minor change it appears it has a dependency on Mongoid v7 and changes it has made around not using ActiveSupport method `delegate` since version 7.1

We ascertained this from a statement made in the issue [mongoid 7.1.0 issue with arguments](mongoid/mongoid-locker#85 (comment))

> Mongoid gem doesn't use ActiveSupport method delegate since 7.1 version.

The issue was fixed in the mongoid-locker PR [Add forwardable module and upgrade rubocop](mongoid/mongoid-locker#86). And that change seems to be the key difference between version 2.0.0 and 2.0.1.

The error we see in the apps when v2.0.1 is being used is

```
An error occurred while loading ./spec/forms/waste_carriers_engine/base_forms_spec.rb.
Failure/Error: delegate :contact_address, :contact_email, :registered_address, to: :registration
ArgumentError:
  wrong number of arguments (given 4, expected 1)
```

In this example if you go to order_copy_cards_registration.rb:10 you'll find

```ruby
    delegate :contact_address, :contact_email, :registered_address, to: :registration
```

Depending on whether you run rspec or try to hit a page in the app this is the error that gets thrown.

So we are pinning the version of mongoid-locker we use, until we can complete the work to upgrade the version of ruby and rails we are using. We should then be able to use Mongoid v7.1 (or greater) and hopefully the issue goes away!
  • Loading branch information
Cruikshanks committed Jun 18, 2020
1 parent c73ff79 commit b3c15c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ PATH
jbuilder (~> 2.0)
jquery-rails
mongoid (~> 5.2.0)
mongoid-locker
mongoid-locker (= 2.0.0)
nokogiri
rails (~> 4.2.11)
rest-client (~> 2.0)
Expand Down Expand Up @@ -165,7 +165,7 @@ GEM
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.0425)
mime-types-data (3.2020.0512)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.1)
Expand All @@ -176,7 +176,7 @@ GEM
mongo (>= 2.4.1, < 3.0.0)
origin (~> 2.3)
tzinfo (>= 0.3.37)
mongoid-locker (2.0.1)
mongoid-locker (2.0.0)
mongoid (>= 5.0, < 8)
multi_json (1.14.1)
multipart-post (2.1.1)
Expand Down
6 changes: 4 additions & 2 deletions waste_carriers_engine.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ Gem::Specification.new do |s|
s.add_dependency "rails", "~> 4.2.11"
# Use MongoDB as the database
s.add_dependency "mongoid", "~> 5.2.0"
# Implement document-level locking
s.add_dependency "mongoid-locker"
# Implement document-level locking. Pinned to 2.0.0 because we believe 2.0.1
# has a dependency on using Mongoid version 7 or greater. On v5 we get errors
# regards the use of `delegate` when using 2.0.1
s.add_dependency "mongoid-locker", "2.0.0"
# Use jquery as the JavaScript library
s.add_dependency "jquery-rails"
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
Expand Down

0 comments on commit b3c15c8

Please sign in to comment.