mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
bf04aaa068
Most of this was fixed by adding the `attribute-defined-statically-cop` branch of `thoughtbot/rubocop-rspec` to the Gemfile and running: ```sh rubocop \ --require rubocop-rspec \ --only FactoryBot/AttributeDefinedStatically \ --auto-correct ``` I had to update the cucumber tests manually, and I realized our changes don't handle `ignore` blocks or blocks with arity 1 that use the yielded DefinitionProxy. I will update https://github.com/rubocop-hq/rubocop-rspec/pull/666to handle these cases.
17 lines
372 B
Ruby
17 lines
372 B
Ruby
describe "aliases and overrides" do
|
|
before do
|
|
FactoryBot.aliases << [/one/, "two"]
|
|
|
|
define_model("User", two: :string, one: :string)
|
|
|
|
FactoryBot.define do
|
|
factory :user do
|
|
two { "set value" }
|
|
end
|
|
end
|
|
end
|
|
|
|
subject { FactoryBot.create(:user, one: "override") }
|
|
its(:one) { should eq "override" }
|
|
its(:two) { should be_nil }
|
|
end
|