ruby on rails - Visit method not found in my rspec -
my java web application running on tomcat @ http://localhost:8080/
writing first spec, home_spec:
require 'spec_helper' describe "home" "should render home page" visit "/" page.should have_content("hello world") end end
and running:
rspec
i get:
f failures: 1) home should render home page failure/error: visit "/" nomethoderror: undefined method `visit' #<rspec::core::examplegroup::nested_1:0x242870b7> # ./spec/home/home_spec.rb:7:in `(root)' finished in 0.012 seconds 1 example, 1 failure failed examples: rspec ./spec/home/home_spec.rb:6 # home should render home page
shouldn't work because have included capybara in spec_helper?
how know visit correct url? if url localhost:3030 or localhost:8080?
my gemfile:
source 'http://rubygems.org' gem "activerecord" gem "rspec" gem "capybara" gem "activerecord-jdbcmysql-adapter"
my spec_helper:
require 'capybara/rspec'
regarding rspec issues (https://github.com/rspec/rspec-rails/issues/360)
you should put
config.include capybara::dsl
in spec_helper.rb, inside config block.
Comments
Post a Comment