I have the below code in my index_spec.rb
require '../../spec_helper'
describe "Dashboards" do
describe "Welcome Widget" do
it "should have the content" do
visit '../../dashboards/index'
page.should have_content('Random Content.')
end
end
end
i ran rspec index_spec.rb
and it failed saying 'unidentified method visit'
, then i searched on the net and included the following in the spec_helper.rb
require 'capybara'
include Capybara::DSL
when i include it, it shows me " syntax error, unexpected tIDENTIFIER, expecting $end
" at spec_helper.rb: 1
, i have been trying this out for last three hours, could not figure out where i need to put 'end' in the spec_helper file. Let me know if some worked on dashing and validated the dashboard file using rspec
First you should add capybara
to your Gemfile and bundle it. Then add to spec_helper.rb
:
require 'capybara/rspec'
Also
# change this:
# visit '../../dashboards/index'
# to:
visit dashboard_path
https://github.com/jnicklas/capybara#using-capybara-with-rspec