我成功地安装了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下生成了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?
发布于 2017-02-03 00:36:56
我也遇到过类似的问题,但我使用的是Ubuntu Linux,对windows一无所知。我刚刚更新到最新版本,您可以在相应的存储库中找到它:guard-rspec,但在您的情况下,这似乎不可能。如果您使用的是Windows10,则可以使用Linux beta environment
我希望我在Stackoverflow中的第一个答案对您和/或某些人仍然有用:)。
干杯!
托尼奥
https://stackoverflow.com/questions/39152444
复制