当我运行autotest时,得到以下错误。奇怪的是,我没有文件夹/Library/Ruby/Gems/1.8/,而是文件夹/Library/Ruby/Gems/1.9.1/。
帮助?谢谢。
Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/heroku-2.8.6.gemspec]: invalid date format in specification: "2011-10-07 00:00:00.000000000Z"
loading autotest/rails_rspec2
-------------
在运行rspec测试时,我将收到以下弃用警告
DEPRECATION WARNING: to_prepare is deprecated and will be removed from Rails 5.1 (use ActiveSupport::Reloader.to_prepare instead) (called from <top (required)> at /Users/Chris/Sites/golf_mentor/config/environment.rb:5)
我的environment.rb第5行
Rails.application.initialize!
如何
我把我的Rails-App和Capybara放在一起了。测试工作正常,但我得到了以下错误:
2019年-05-03 14:51:58警告硒不推荐使用Selenium::WebDriver::Chrome#driver_path=。使用Selenium::WebDriver::Chrome::Service#driver_path=代替。
Gemfile
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2
在我的Rails应用程序中,运行guard init rspec时会收到此警告
Warning: you have a Gemfile, but you're not using bundler or
RUBYGEMS_GEMDEPS
14:54:15 - INFO - Writing new Guardfile to
/home/ubuntu/railsprojects/sillyfish/Guardfile 14:54:16 - INFO - rspec
guard added to Guardfile, feel free to edit it
我不明白它为什么会出现。无视这个警
我刚用postgres 9.5将Rails 4.2.0应用程序的ruby从2.2.4升级到2.3.3。启动rails s时,pg适配器未加载:
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec': Specified 'postgresql' for data
base adapter, but the gem is not lo
当我运行这个RSpec示例时,它会通过,但我会收到一个反对建议的警告。
context "should have valid detail for signup" do
it "should give error for invalid confirm password" do
find("#usernamesignup").set("Any_name")
find("#mobile_number").set("1234567890")
find("#emails
最近,我升级了一个Rails应用程序,我正在维护它为Rails 6 RC2 (来自5.2.3)。所以,在升级之后,我就运行了自动化测试(RSpec),测试输出给了我很多不推荐的警告。其中一个警告是:
DEPRECATION WARNING: render file: should be given the absolute path to a file
因此,我转到了触发警告的视图文件,并进行了如下更改,
以前:render file: 'devise/sessions/new'
后:render file: Rails.root.join('app',
我还不能确定这一问题的原因,但我收到了在Rails项目中多次加载共享规范的弃用警告。下面是它们的定义:
spec/support/shared/authenticated_endpoints_spec.rb
RSpec.shared_examples "an authenticated endpoint" do
it_behaves_like "an authenticated show endpoint"
it_behaves_like "an authenticated index endpoint"
end
RSpec.share
在即将升级到5.1的Rails 5.0.7应用程序中,我们希望将所有(许多)不推荐的警告都捕获到一个文件中。
RSpec3.9提供了一个非常清楚的示例,说明如何向文本文件发送推荐:
但这不管用:
# spec/spec_helper.rb
RSpec.configure do |config|
config.deprecation_stream = File.open('deprecations.txt', 'w')
end
当我运行一个没有警告的规范时(上面的代码),stdout会显示一堆:DEPRECATION WARNING: uniq is dep
我正在创建一个Rails应用程序,并刚刚添加了一个文件(app/spec/models/test_spec.rb ),其中包含5个新的rspec测试:
describe Topic do
describe "scopes" do
before do
@public_topic = Topic.create # default is public
@private_topic = Topic.create(public: false)
end
describe "publicly_viewable
当我做“rspec_junit_formatter”时有问题
包exec格式RspecJunitFormatter
我有这样的错误,怎么解决呢?
home/stasyan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.4/lib/rspec/core/formatters/deprecation_formatter.rb:186:in `puts': Treating `metadata[:execution_result]` as a hash is deprecated. Use the attributes methods to access
当我运行rspec时收到以下警告:-
DEPRECATION WARNING: Using positional arguments in functional tests has been deprecated,
in favor of keyword arguments, and will be removed in Rails 5.1.
Deprecated style:
get :show, { id: 1 }, nil, { notice: "This is a flash message" }
New keyword style:
get :show, para
当我运行rspec进行测试时,我得到了以下错误:
无法加载这样的文件-- mocha/object (LoadError) --问题在于下面一行:config.mock_with :mocha
这是我的spec_helper.rb:
require 'rubygems'
require 'spork'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration
我正在尝试对一个普通的旧Ruby对象进行单元测试,该对象有一个方法,该方法在Rails模型上调用一个类方法。Rails应用程序相当大(加载时间为10秒),所以我宁愿避免加载所有Rails来进行单元测试,测试应该在1s以下运行。
示例:
class Foo
def bar
SomeRailsModel.quxo(3)
end
end
RSpec.describe Foo do
let(:instance) { Foo.new }
it 'calls quxo on SomeRailsModel' do
expect(SomeRailsModel