现在有一个奇怪的问题与轨道(5.0.5)。我知道渲染和返回正在运行,因为我可以使用binding.pry来介入。它应该返回一个状态码forbidden,但是当我运行我的测试时,它返回状态码204没有内容。 # we already know this user has permission for org_claim_codes#create but we need to check they a
当我的it块之一失败时,我想要运行清理步骤。当所有的it块成功时,我不希望运行清理步骤。 RSpec.describe 'my describe' do
it 'first it' do
logic_that_might_fail
end
it 'second it' do
logic_that_might_fail
end
如何在RSpec中定义当前范围的主题(改进主题)时访问父范围的主题? 示例代码: describe MyModule.method(:some_method) do
context "when called with a String" do
let(:string) { "Hey there!" }
# I want to refine the subject
我的模型有关于其相关模型之一的验证。由于此验证,我的rspec测试模型失败。 describe NewOfferRange do
it { is_expected.to validate_presence_of(:new_offer) }
it { is_expected.to validate_presence_of(:from) }
it { is_expecte
在我的应用程序中,一个帐户可以有一个拥有者(用户)和多个用户。 在我的测试中我这样做: # account_factory_static.rb
FactoryGirl.define do
factory :account do
name 'demoaccount'
association :owner, :factory => :user
end
end