File: keyed_by_class_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-- 362 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
describe "finding factories keyed by class instead of symbol" do
  before do
    define_model("User") do
      attr_accessor :name, :email
    end

    FactoryBot.define do
      factory :user
    end
  end

  it "doesn't find the factory" do
    expect { FactoryBot.create(User) }.to(
      raise_error(KeyError, /Factory not registered: User/)
    )
  end
end