无法加载这样的文件 - guard / rspec / dsl

时间:2016-08-25 18:31:40

标签: ruby-on-rails-4 rspec-rails

我能够成功安装rspec-rails和guard-rspec。我正在使用Windows,因此rspec的版本必须是旧的才能成功安装。

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

  gem 'postgresql'
  gem 'rspec-rails', '2.8', :require => false #'2.8'
end

group :development do
  gem 'web-console'
  gem 'better_errors'
  gem 'binding_of_caller'
  gem 'ruby_dep', '1.4.0'
  gem 'guard-rspec', require: false#'4.2.'
end

我运行了rails g rspec:install并且规范生成了spec-helper.rb。没有rails-helper.rb虽然。我也有.rspec文件。

运行guard init rspec

后,我收到了以下信息
10:56:04 - INFO - Writing new Guardfile to C:/Users/nidaa_bugis/Documents/Ruby practices/workspace/Testing/Guardfile
10:56:05 - INFO - rspec guard added to Guardfile, feel free to edit it

但是当我运行bundle exec guard时,我收到此错误

10:56:39 - INFO - Run 'gem install win32console' to use color on Windows
10:56:39 - ERROR - Invalid Guardfile, original error is:
> [#]
> [#] cannot load such file -- guard/rspec/dsl,
> [#] backtrace:
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C
> [#]   (dsl)> C

有人知道如何解决这个问题,最后在Windows上运行guard和rspec吗?

1 个答案:

答案 0 :(得分:-1)

我有类似的问题,但我有Ubuntu Linux,不知道windows。 我刚刚更新到最新版本,您可以在相应的存储库中找到它: guard-rspec 但似乎在你的情况下这是不可能的。 如果您使用的是Windows 10,则可以使用Linux beta environment

我希望Stackoverflow中的第一个答案对您和/或某些人仍然有用:)。

干杯!

托尼奥