Skip to content

Works generator generates tests that fail miserably #513

@flyingzumwalt

Description

@flyingzumwalt

In a freshly generated Rails app where I ran the rails g curate -f generator, When I run

$ rails g curate:work Text

it adds a suite of 50+ tests. Most of those tests fail.

To get most of the generated tests to pass

I had to do the following:

In spec/spec_helper.rb, add

require 'curate/spec_support'

AND THEN
add these to Gemfile:

gem 'poltergeist' 
gem 'vcr'
gem 'webmock'

AND

  1. delete spec/factories/people_factory.rb
  2. copy spec/matchers from curate into host app spec/support/matchers

That leaves 4 tests still failing

  1) Text behaves like remotely_identified by doi with valid attributes mints!
     Failure/Error: Hydra::RemoteIdentifier.mint(remote_service_name, subject)
     RuntimeError:
       Make sure to set your Curate.configuration.application_root_url
     Shared Example Group: "remotely_identified" called from ./spec/repository_models/text_spec.rb:14
     # ./config/initializers/hydra-remote_identifier_config.rb:6:in `block (4 levels) in <top (required)>'

  2) CurationConcern::TextsController behaves like is_a_curation_concern_controller #edit someone elses private work should show 401 Unauthorized
     Failure/Error: get :edit, id: a_work
     CanCan::AccessDenied:
       You are not authorized to access this page.
     Shared Example Group: "is_a_curation_concern_controller" called from ./spec/controllers/curation_concern/texts_controller_spec.rb:6
     # /Users/matt/.rvm/gems/ruby-1.9.3-p545/gems/cancan-1.6.10/lib/cancan/ability.rb:208:in `authorize!'
     # /Users/matt/.rvm/gems/ruby-1.9.3-p545/gems/cancan-1.6.10/lib/cancan/controller_additions.rb:338:in `authorize!'
     # /Users/matt/.rvm/gems/ruby-1.9.3-p545/bundler/gems/curate-d17e75b7e862/app/controllers/curation_concern/base_controller.rb:40:in `authorize_curation_concern!'

  3) CurationConcern::TextsController behaves like is_a_curation_concern_controller #edit someone elses public work should show me the page
     Failure/Error: get :edit, id: a_work
     CanCan::AccessDenied:
       You are not authorized to access this page.
     Shared Example Group: "is_a_curation_concern_controller" called from ./spec/controllers/curation_concern/texts_controller_spec.rb:6
     # /Users/matt/.rvm/gems/ruby-1.9.3-p545/gems/cancan-1.6.10/lib/cancan/ability.rb:208:in `authorize!'
     # /Users/matt/.rvm/gems/ruby-1.9.3-p545/gems/cancan-1.6.10/lib/cancan/controller_additions.rb:338:in `authorize!'
     # /Users/matt/.rvm/gems/ruby-1.9.3-p545/bundler/gems/curate-d17e75b7e862/app/controllers/curation_concern/base_controller.rb:40:in `authorize_curation_concern!'

  4) CurationConcern::TextsController behaves like is_a_curation_concern_controller #new my work should show me the page
     Failure/Error: expect(response.body).to have_tag('.promote-doi .control-group') do
     NoMethodError:
       undefined method `has_tag?' for #<String:0x007f863c423cf8>
     Shared Example Group: "is_a_curation_concern_controller" called from ./spec/controllers/curation_concern/texts_controller_spec.rb:6
     # /Users/matt/.rvm/gems/ruby-1.9.3-p545/gems/rspec-expectations-2.14.5/lib/rspec/matchers/built_in/has.rb:10:in `matches?'
     # /Users/matt/.rvm/gems/ruby-1.9.3-p545/gems/rspec-expectations-2.14.5/lib/rspec/expectations/handler.rb:24:in `handle_matcher'

Finished in 34.37 seconds
52 examples, 4 failures

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions