Hello, when passing the test an uninitialized constant Devise :: Test (NameError) error occurs. I added lines to spec_hepler and rails_helper:
config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :view Test:
require 'spec_helper' include Devise::Test::ControllerHelpers RSpec.describe CommentsController do describe "create action" do @user = User.where(email: "123123@test.com") sign_in @user it "redirect to place_path if place is save" do post :create, comment: { body: "Comment test body", user_id: 1 } response.should redirect_to place_path(assigns(:comment)) end it "redirect to rot_path if validation fail" do post :create, comment: { body: "", user_id: 1 } response.should redirect_to root_path end end end Rspec - 3.4.4
Devise - 4.1.0
spec_helper
ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' require 'rspec/autorun' RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods config.raise_errors_for_deprecations! config.infer_spec_type_from_file_location! config.include Devise::Test::ControllerHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :view config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end end
spec_helperandrails_helper. Most likely, nothing inside the test is known about Devise - MAXOPKARspecanddevise? - anoamRSpec, it seems to includerails_helperand notspec_helper. - anoam