Giter Site home page Giter Site logo

Comments (9)

Fryie avatar Fryie commented on September 6, 2024

A "require 'capybara'" at the top of page.rb should fix the issue.
Maybe this could be included in future versions?

from site_prism.

natritmeyer avatar natritmeyer commented on September 6, 2024

Did it work when you added require 'capybara'?

from site_prism.

Fryie avatar Fryie commented on September 6, 2024

Yes.

from site_prism.

natritmeyer avatar natritmeyer commented on September 6, 2024

Hi @Fryie, since this works fine when you require 'capybara', as stated in the README.md, I'm going to close this.

from site_prism.

Fryie avatar Fryie commented on September 6, 2024

I think this has been a misunderstanding.

I added "require 'capybara'" to page.rb, which worked.
Adding capybara to spec_helper.rb doesn't help at all. No matter whether it's declared at the top or inside either of the Spork blocks.

from site_prism.

natritmeyer avatar natritmeyer commented on September 6, 2024

Are you requiring your spec_helper.rb in your .rspec file?

from site_prism.

Fryie avatar Fryie commented on September 6, 2024

Doesn't change anything.

Spork preloads the entire Rails environment. At that point, RSpec or Cucumber files haven't been loaded yet.
It may be Spork's fault not to provide a custom initializer (or maybe I'm just too stupid to find it), but still I think that a gem should manage its own dependencies. What would be the harm in requiring capybara explicitly from site_prism?

As an aside, the same problem happens - for whatever reason - when committing the codebase to travis CI. See: https://travis-ci.org/Fryie/stuts-orga/jobs/10685216

from site_prism.

natritmeyer avatar natritmeyer commented on September 6, 2024

I've never used spork before, but having quickly scanned the documentation it looks like require 'capybara' should go in a...

Spork.prefork do
  #...
end

...block. Dunno, just a guess...

from site_prism.

Fryie avatar Fryie commented on September 6, 2024

Spork is just a test server against which rspec or cucumber run. It preloads the Rails environment and does not read the spec_helper.rb (or env.rb) files - that happens later, when rspec or cucumber connects to it. At least that's the way I understand it.

Travis CI seems to do a similar thing, just preloading the Rails environment before running any tests.

When preloading the environment, capybara has not been required yet, hence (I guess) the error.

from site_prism.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.