File: aliases_spec.rb

package info (click to toggle)
ruby-factory-bot 6.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,372 kB
  • sloc: ruby: 7,827; makefile: 6
file content (17 lines) | stat: -rw-r--r-- 372 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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