File: sequence_spec.rb

package info (click to toggle)
ruby-factory-bot 6.5.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,492 kB
  • sloc: ruby: 9,242; makefile: 6; sh: 4
file content (14 lines) | stat: -rw-r--r-- 471 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
describe FactoryBot::Attribute::Sequence do
  let(:sequence_name) { :name }
  let(:name) { :first_name }
  let(:sequence) { FactoryBot::Sequence.new(sequence_name, 5) { |n| "Name #{n}" } }

  subject { FactoryBot::Attribute::Sequence.new(name, sequence_name, false) }
  before { FactoryBot::Internal.register_sequence(sequence) }

  its(:name) { should eq name }

  it "assigns the next value in the sequence" do
    expect(subject.to_proc.call).to eq "Name 5"
  end
end