On 17/02/14 10:35 PM, Vishwajeet Mishra wrote:
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"
shouldn't this be:
Capybara.app_host = "http://localhost:3000"
not sure if that is the issue or not, but it looks suspicious.
This is also a capybara issue, not an rspec issue, so you might have
better luck raising the issue over there.
Cheers,
Xav
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
--
You received this message because you are subscribed to the Google
Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/c627011a-a39e-4cc7-9584-8cbd631f567a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/530386C7.40603%40xaviershay.com.
For more options, visit https://groups.google.com/groups/opt_out.