openjournals / theoj

The Open Journal
http://theoj.org
MIT License
129 stars 10 forks source link

Failing test #247

Closed arfon closed 8 years ago

arfon commented 8 years ago

Demonstration of #239 bug in the tests.

This test is failing as follows:

  1) PapersController PUT #transition AS EDITOR responds successfully with a correct status and accept paper
     Failure/Error: put :transition, identifier:paper.typed_provider_id, transition: :accept
     AASM::InvalidTransition:
       Event 'resolve' cannot transition from 'unresolved'
     # ./app/models/paper.rb:151:in `resolve_all_issues'
     # ./app/controllers/papers_controller.rb:93:in `transition'
     # ./spec/support/controller_spec_helpers.rb:36:in `process_with_default_params'
     # ./spec/controllers/papers_controller_spec.rb:382:in `block (3 levels) in <top (required)>'

because resolve_all_issues on Paper calls resolve on each Annotation.

As the resolve call on Annotation is guarded with can_change_state which checks to see if the paper is under_review? before changing the state of the annotation. This fails as the paper isn't in the under_review state, it's review_completed.

marcrohloff commented 8 years ago

Thanks for finding this, I'm going to write a slightly different test,