Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Shared rspec example groups not loading #39

@adamfortuna

Description

@adamfortuna

Hey there, I'm having an issue with hydra with rspec where shared examples aren't able to be used for some reason (shared_examples_for).

It's able to load my environment and successfully run tests, but when it comes to one that uses shared examples defined in another file that was loaded on startup, it errors out.

I created a demo project that has the full stacktrace of the error that you should be able to reproduce:
RAILS_ENV=test rake hydra
https://github.com/adamfortuna/hydra-rspec-failure-demo

Here's a briefer overview:
In spec_helper.rb we load up some rspec shared examples:

Dir[File.expand_path('../support/**/*.rb', __FILE__)].each do |file|
  require(file)
end
shared_examples_for "a demo example" do
  it "doesnt error out" do
    true.should == true
  end
end

Then attempt to use these later on in a test:

require 'spec_helper'
describe ApplicationHelper do
  it_should_behave_like "a demo example"
end

Which results in this error:

1303850302.11934 RUNNER| Running file: spec/helpers/application_helper_spec.rb
1303850302.18619 RUNNER| Could not find shared example group named "a demo example"
/Users/adam/.rvm/gems/ree-1.8.7-2010.02/gems/rspec-core-2.0.0.beta.19/lib/rspec/core/example_group.rb:65:in `it_should_behave_like': Could not find shared example group named "a demo example" (RuntimeError)

Full dump, gem versions and the rest in the repo, but it might just be a setup error on my part. I've tried this with various different rspec/hydra gem versions, but right now the demo is running 'hydra', '0.23.0' and 'rspec', '2.0.0.beta.19'. This spec can be run by itself, but errors out when run form hydra. Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions