无法使用capistrano加载此类文件 - rspec / core / rake_task

时间:2017-07-03 14:07:44

标签: ruby-on-rails ruby rspec capistrano capistrano3

我不是铁轨上的红宝石。当我发布时:

cap integration deploy

我收到错误:

INFO [90feb630]  Running /usr/local/rvm/bin/rvm ruby-2.4.0@myproject_gemset do bundle exec rake assets:precompile as myproject@myproject-server.com 
DEBUG [90feb630] Command: cd /home/myproject/myproject_rails/releases/20170703135523 && ( export RAILS_ENV="staging" RAILS_GROUPS="" ; /usr/local/rvm/bin/rvm ruby-2.4.0@myproject_gemset do bundle exec rake assets:precompile )
DEBUG [90feb630] rake aborted!
LoadError: cannot load such file -- rspec/core/rake_task

这是我用于部署的capistrano配置文件:

set :user, 'myproject'

server 'myproject-server.com',
  user: fetch(:user),
  roles: %w{web app db},
  ssh_options: {forward_agent: true}

set :deploy_to, "/home/#{fetch(:user)}/#{fetch(:application)}"

set :rails_env, 'staging'

set :conditionally_migrate, true

set :keep_releases, 2

set :branch, 'master'

set :app_version, '0.1'

修改

问题来自文件/lib/tasks/integration.rake:

require 'rspec/core/rake_task'

    namespace :integration do
      desc 'integration test the JSON API endpoints'
      RSpec::Core::RakeTask.new(:test) do |t|
        # set the RAILS_ENV such that :integration tagged
        # specs are run
        ENV['RAILS_ENV'] = 'test'

        # only run those files in the 'integration' directory
        t.pattern = './spec/integration{,/*/**}/*_spec.rb'
      end
    end

1 个答案:

答案 0 :(得分:0)

gem'rspec-core',只安装在dev / test env。

所以它不见了。

gem 'rspec-core', '~> 3.4' 

出于

group :development, :test do

解决了我的问题