I am writing this code but getting some error like this given at end ....please tell me what i am doing wrong and what are right steps to write the tset code
CODE:
require 'spec_helper'
require 'rubygems'
require 'capybara'
require 'capybara/dsl'
require 'capybara/rspec'
require 'selenium-webdriver'
Capybara.run_server = false
Capybara.current_driver = :selenium
Capybara.app_host = "http:localhost:3000"
include Capybara::DSL
describe "Managing Carpenters" , :type=> :feature do
it "Creates a new carpenter" do
visit '/carpenters'
click_link "New Carpenter"
fill_in "Name" , with: "Jay"
fill_in "Address" , with: "kharghar"
fill_in "Image" , with: "fkjdsfk"
fill_in "Contact no" , with: "
9005602345"
fill_in "Experience" , with: "5 yrs"
select "Mumbai" , from: "Work city1"
select "Nasik" , from: "Work city2"
select "Company", from: "Category"
fill_in "About" , with: "this is testing"
click_link_or_button "Create Carpenter"
puts find_link("Back").visible?
expect(page).to have_content 'created.'
click_link "Back"
click_link "New Carpenter"
sleep 3
end
describe "Manage carpeneters2 , :type=> :feature" do
it "Creates a new carpenter with wrong city1" do
visit '/carpenters'
click_link "New Carpenter"
fill_in "Name" , with: "Jay"
fill_in "Address" , with: "kharghar"
fill_in "Image" , with: "fkjdsfk"
fill_in "Contact no" , with: "
9005602345"
fill_in "Experience" , with: "5 yrs"
select "Mumbai1" , from: "Work city1"
select "Nasik" , from: "Work city2"
select "Company", from: "Category"
fill_in "About" , with: "this is testing"
click_link_or_button "Create Carpenter"
expect(page).to have_content 'prohibited'
end
end
end
Error:
1) Managing Carpenters Manage users2 , :type=> :feature Creates a new carpenter with wrong city1
Failure/Error: visit '/carpenters'
ArgumentError:
rack-test requires a rack application, but none was given
# ./spec/user_spec.rb:42:in `block (3 levels) in <top (required)>'
Finished in 12.03 seconds
2 examples, 1 failure
Failed examples:
rspec ./spec/user_spec.rb:41 # Managing Carpenters Manage users2 , :type=> :feature Creates a new carpenter with wrong city1
Randomized with seed 43974