“Visit” problems in integration tests in the rail guide

I am new to rails and walk through rails 3 textbooks . I have a problem with integration tests. The “visit” (Webrat?) Method seems to always fail. This is the error message I get from rspec:

Failure/Error: visit signup_path
Unknown Webrat mode: nil

Please ensure you have a Webrat configuration block that specifies a mode
in your test_helper.rb, spec_helper.rb, or env.rb (for Cucumber).

This configure block supercedes the need to require "webrat/<framework>".

For example:

  Webrat.configure do |config|
    config.mode = :rails
  end
# ./spec/requests/users_spec.rb:27:in `block (5 levels) in <top (required)>'
# ./spec/requests/users_spec.rb:26:in `block (4 levels) in <top (required)>'

I tried adding the Webrat tuner above to spec / spec_helpers.rb and I get this error:

Failure/Error: visit signup_path
no such file to load -- action_controller/integration
# ./spec/requests/users_spec.rb:27:in `block (5 levels) in <top (required)>'
# ./spec/requests/users_spec.rb:26:in `block (4 levels) in <top (required)>'

I read other topics about this issue, and they suggested using "config.mode =: rack", if I do this, I will get this error:

Failure/Error: visit signup_path
undefined method `last_response' for #<RSpec::Core::ExampleGroup::Nested_5::Nested_1::Nested_2:0xa4b8aac>
# ./spec/requests/users_spec.rb:27:in `block (5 levels) in <top (required)>'
# ./spec/requests/users_spec.rb:26:in `block (4 levels) in <top (required)>'

I think it may be important to note that I started the win7x64 tutorial, but I tried to clone the repository on ubuntu with the same errors. Here is the repository if someone wants to see:

git://github.com/ender4/sample_app2.git , 2 ^

, rails/rspec/webrat (, ), , / .

.

+3
3

, ...   :

:

1)    /: signup_path    NameError:       undefined `signup_path ' #

... , :

:          /spec/requests/users _spec.rb :          /spec/model/user _spec.rb

, !: 0 < >  ... , , !:)

+6

:

group :development do
  gem 'rspec-rails', '2.4.1'
end

group :test do
  gem 'rspec', '2.4.0'
  gem 'webrat', '0.7.1'
end

!

+1

I think I found the culprit, rspec 2.2.0. Using the problem with rspec 2.1.0 fixes the problem.

0
source

Source: https://habr.com/ru/post/1778606/


All Articles