2017-01-05 1 views
0

나는 전에 RSpec을 사용하고 내가 실행하려고하면이 내가이 오류가 처음이다 :RSpec을 설치하려고 할 때 왜이 오류가 발생합니까?

:

그것은이 오류가 발생
rails generate rspec:install 

:

/Users/ldco2016/Projects/workout_app/config/application.rb:11:in `require': cannot load such file -- action_cable/engine (LoadError) 
    from /Users/ldco2016/Projects/workout_app/config/application.rb:11:in `<top (required)>' 
    from /Users/ldco2016/.rvm/gems/ruby-2.2.5/gems/spring-2.0.0/lib/spring/application.rb:82:in `require' 
    from /Users/ldco2016/.rvm/gems/ruby-2.2.5/gems/spring-2.0.0/lib/spring/application.rb:82:in `preload' 
    from /Users/ldco2016/.rvm/gems/ruby-2.2.5/gems/spring-2.0.0/lib/spring/application.rb:143:in `serve' 
    from /Users/ldco2016/.rvm/gems/ruby-2.2.5/gems/spring-2.0.0/lib/spring/application.rb:131:in `block in run' 
    from /Users/ldco2016/.rvm/gems/ruby-2.2.5/gems/spring-2.0.0/lib/spring/application.rb:125:in `loop' 
    from /Users/ldco2016/.rvm/gems/ruby-2.2.5/gems/spring-2.0.0/lib/spring/application.rb:125:in `run' 
    from /Users/ldco2016/.rvm/gems/ruby-2.2.5/gems/spring-2.0.0/lib/spring/application/boot.rb:19:in `<top (required)>' 
    from /Users/ldco2016/.rvm/rubies/ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' 
    from /Users/ldco2016/.rvm/rubies/ruby-2.2.5/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' 
    from -e:1:in `<main>' 

이 내 gemfile입니다

소스 'https://rubygems.org'

git_source (: github) do | repo_name | repo_name = "# {repo_name}/# {repo_name}"repo_name.include하지 않는 한? ("/") "https://github.com/# {repo_name} .git"이것은 내 설정/application.rb입니다

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '~> 4.2.0' 
# Use sqlite3 as the database for Active Record 
gem 'sqlite3' 
# Use Puma as the app server 
gem 'puma', '~> 3.0' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.2' 
# See https://github.com/rails/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 
gem 'turbolinks', '~> 5' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.5' 
# Use Redis adapter to run Action Cable in production 
# gem 'redis', '~> 3.0' 
# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development, :test do 
    gem 'rspec-rails', '3.2.3' 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug', platform: :mri 
end 

group :development do 
    # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. 
    gem 'web-console', '>= 3.3.0' 
    gem 'listen', '~> 3.0.5' 
    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 
    gem 'spring' 
    gem 'spring-watcher-listen', '~> 2.0.0' 
end 

group :test do 
    gem 'capybara', '2.4.4' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 

끝 :

require_relative 'boot' 

require "rails" 
# Pick the frameworks you want: 
require "active_model/railtie" 
require "active_job/railtie" 
require "active_record/railtie" 
require "action_controller/railtie" 
require "action_mailer/railtie" 
require "action_view/railtie" 
require "action_cable/engine" 
require "sprockets/railtie" 
# require "rails/test_unit/railtie" 

# Require the gems listed in Gemfile, including any gems 
# you've limited to :test, :development, or :production. 
Bundler.require(*Rails.groups) 

module WorkoutApp 
    class Application < Rails::Application 
    # Settings in config/environments/* take precedence over those specified here. 
    # Application configuration should go into files in config/initializers 
    # -- all .rb files in that directory are automatically loaded. 
    end 
end 

답변

2

이 문제는 RSpec과 관련이 없습니다. Rails 4 애플리케이션에서 (Gemfile에 따라) action_cable을로드하려고하는데, 이는 Rails 5에 대한 내장 기능입니다. application.rb에서이 줄을 제거하면됩니다.

app/application.rb에서
require 'rails/all' 
+0

을 언급하지 않고이 문제를 해결하는 방법이 있나요 :에 의해

require "action_cable/engine" 

당신이 정말로 독립적으로 레일 모듈을로드 할 필요가없는 경우, 바로 교체는 모든이 필요 새로운 레일 앱을 만들 수 있습니까? 모든 레일 5 기능을 제거하고 다음과 같은 다른로드 블록을 치기 때문에 묻습니다 : ActiveSupport : Module (NoMethodError)에 대해 정의되지 않은 메소드'to_time_preserves_timezone = ' – Daniel

+0

Rails 5 앱에서 Rails 4로 돌아가시겠습니까? –

0

"require "action_cable/engine"

+0

골격 애플 리케이션 이었기 때문에 나는 그것을 그냥 날려 버리기로 결심했고, 또 다른 SO_ 새로운 my_app을 시작한다고 말하는 다른 SO 설명서를 보았습니다. – Daniel