RSpec Rails 语法助手
RSpec Rails syntax helpers
我正在使用 rspec-rails v3.4.2。我在网上看到很多例子如下
describe "My Test Suite" do
# ...
end
feature "My Awesome Feature" do
# ...
end
我对 FactoryGirl 有类似的东西,写 create(:model)
而不是输入完整版本,FactoryGirl.create(:model)
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end
RSpec语法方法是否相同?
默认情况下,您可以使用 describe
、shared_examples
等,不带 RSpec
前缀。另请查看 https://relishapp.com/rspec/rspec-core/v/3-0/docs/configuration/global-namespace-dsl 了解详情
我正在使用 rspec-rails v3.4.2。我在网上看到很多例子如下
describe "My Test Suite" do
# ...
end
feature "My Awesome Feature" do
# ...
end
我对 FactoryGirl 有类似的东西,写 create(:model)
而不是输入完整版本,FactoryGirl.create(:model)
RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
end
RSpec语法方法是否相同?
默认情况下,您可以使用 describe
、shared_examples
等,不带 RSpec
前缀。另请查看 https://relishapp.com/rspec/rspec-core/v/3-0/docs/configuration/global-namespace-dsl 了解详情