I'm trying to run Capybara without Rails,Cucumber,Rspec just in pure Ruby.
My test script looks like this:
require 'capybara'
require 'selenium-webdriver'
url = "MyAccessKey"
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome
capabilities.platform = :LINUX
Capybara.register_driver :sauce do |app|
Capybara::Selenium::Driver.new(app,
:browser => :remote, :url => url,
:desired_capabilities => capabilities)
end
Capybara.default_driver=:sauce
Capybara.app_host="127.0.0.1:8888"
include Capybara::DSL
# include Capybara::RSpecMatchers
visit('')
feature "Signing in" do
scenario "Should sign in" do
within ('#form_content') do
fill_in 'login',:with=>'user'
fill_in 'password',:with=>'pwd'
find(:xpath,'//input[@type="submit"]').click
end
end
end
visit
works fine... but feature and scenario
gives a NoMethodError. Should I include anything here?
feature
andscenario
are part of RSpec. This is not loaded by default when using Capybara.Assuming you want to include the Capybara modified RSpec, instead of doing:
Do:
If you just want plain RSpec, you can of course do: