rubyrspecsite-prism

uninitialized constant error with SitePrism page


I've added this to my spec_helper:

require 'capybara'
require 'capybara/dsl'
require 'capybara/rspec'
require 'selenium-webdriver'
require 'site_prism'

And my page is this:

class AboutPage < SitePrism::Page
end

My rspec is this:

require_relative 'spec_helper'

describe 'About Page' do

  it "test" do
    about = AboutPage.new
  end

end

The error I keep getting is:

Failures:

1) About Page test Failure/Error: about = AboutPage.new NameError: uninitialized constant AboutPage # ./about_spec.rb:6:in `block (2 levels) in '


Solution

  • It looks like I needed to add to my spec_helper.rb:

    require_relative about_page.rb
    

    All pages you are using in your spec files have to be required before the can be used.