Reputation: 156
I used gem 'rspec-rails'
(all tests passed) and I updated it to gem 'rspec-rails', '~> 3.0.0.beta'
and now almost all my tests fail, e.g.:
rspec ./spec/features/static_pages_spec.rb:60 # languages index
My test look like:
require 'spec_helper'
describe "languages" do
subject { page }
describe "index" do
before { visit root_path }
it { should have_title('EduWords') }
it { should have_content("Toggle navigation EduWords Home Sign up Log in Authors Back to Top EduWords © MiDaS Project 2014") }
end
end
What am I doing wrong?
config/routes
Eduwords::Application.routes.draw do
get "authors/index"
get "mainpage/index"
resources :tags
resources :languages
resources :words
resources :tests
resources :users
get "sessions/new"
get "users/new"
get "download", to: "words#download", as: 'download'
get "log_out" => "sessions#destroy", :as => "log_out"
get "log_in" => "sessions#new", :as => "log_in"
get "sign_up" => "users#new", :as => "sign_up"
root :to => "mainpage#index"
resources :users
resources :sessions
end
Upvotes: 3
Views: 461
Reputation: 100
Sounds like RSpec isn't finding your route_helper methods (e.g. root_path
). Here's an answer to that question:
https://stackoverflow.com/a/9476576/2231608
Named routes should work if you put the following in rspec_helper.rb:
Rspec.configure do |config|
config.include Rails.application.routes.url_helpers
...
end
Is that how you set it up?
Upvotes: 1