gpt4 book ai didi

RSpec:是否有 `and change` 没有,例如 `and_not to change` ?

转载 作者:行者123 更新时间:2023-12-03 10:23:53 30 4
gpt4 key购买 nike

我找到了 .and方法对于链接许多期望非常有用。

expect {
click_button 'Update Boilerplate'
@boilerplate_original.reload
} .to change { @boilerplate_original.title }.to('A new boilerplate')
.and change { @boilerplate_original.intro }.to('Some nice introduction')

有什么东西可以让我检查一下 没有变化 ?
.and_not change { @boilerplate_original.intro }

类似的东西?我找不到任何东西,而且很难在 Google 上搜索诸如“而不是”之类的东西。

最佳答案

不,没有and_not并且没有通用否定运算符,如 https://github.com/rspec/rspec-expectations/issues/493 中所述

但是,有一种机制可以定义现有匹配器的否定版本,如 http://www.rubydoc.info/github/rspec/rspec-expectations/RSpec/Matchers.define_negated_matcher 中所述。 ,您可以将其与 and 一起使用.

全套复合匹配器记录在 https://www.relishapp.com/rspec/rspec-expectations/v/3-4/docs/compound-expectations

关于RSpec:是否有 `and change` 没有,例如 `and_not to change` ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34967391/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com