我正在尝试使用shoulda匹配器进行一些基本的rspec测试,并且我遇到了一个错误,我之前没有看过这个问题.
我有一个名为name的唯一属性,但由于项目所需的原因,我在config/locales/en.yml中覆盖了我自己的消息形式的默认"已经被拍摄"消息,而且似乎不喜欢它.
我收到此错误消息
Failure/Error: it { should validate_uniqueness_of(:name) }
Flavor did not properly validate that :name is case-sensitively unique.
Given an existing Flavor whose :name is ‹"Factory Flavor Namea"›,
after making a new Flavor and setting its :name to ‹"Factory Flavor
Namea"› as well, the matcher expected the new Flavor to be invalid and
to produce the validation error "has already been taken" on :name. The
record was indeed invalid, but it produced these validation errors
instead:
* name: ["This …Run Code Online (Sandbox Code Playgroud)