-
Notifications
You must be signed in to change notification settings - Fork 0
5 Integrating with RSpec
Justin Watts edited this page Feb 27, 2017
·
1 revision
When employing a SiteObject, we recommend that you pollute RSpec's context/namespace. =
# site.rb
module Ferris
module SiteObject
class MyWebsite
SiteObject.configure do
base_url('http://www.mywebsite.com')
page(:home_page, MyWebsite::Home)
region(:header, MyWebsite::Header) { browser.div(id: 'siteheader') }
end
def logged_in?
header.logout_button.exists?
end
end
end
end
# spec_helper.rb
RSpec.configure do |c|
c.include Ferris::SiteObject
end
c.before(:each) do
Ferris::Browser.browser = Watir::Browser.new :chrome
end
c.after(:each) do
Ferris::Browser.browser.close
end
# spec_helper.rb
c.before(:each) do
Ferris::Browser.browser = Watir::Browser.new :chrome
end
c.after(:each) do
Ferris::Browser.browser.close
end