# spec_helper.rb require 'rspec' require 'watir-webdriver' require 'page-object' require 'page-object/page_factory' require 'require_all' require_all 'lib/pages' RSpec.configure do |config| config.include PageObject::PageFactory config.before(:all) do @browser = Watir::Browser.new :firefox end config.after(:all) do @browser.close end end PageObject::PageFactory.routes = { :default => [[HomePage, :select_puppy], [DetailsPage, :add_to_cart], [ShoppingCartPage, :continue_to_checkout], [CheckoutPage, :complete_order]] } # Example spec agains puppy application require 'spec_helper' describe "Using the adoption site" do context "to adopt puppies it" do before(:each) do visit_page HomePage end it "should display thank you message when adoption is completed" do navigate_to(CheckoutPage).complete_order @current_page.text.should include "Thank you for adopting a puppy!" end it "should require name during checkout" do navigate_to(CheckoutPage).complete_order('name' => '') @current_page.should have_error_message "Name can't be blank" end end end