Sha256: a215b99f2dc8a756367fee83d44213fe08de169963aeec863368a729387e2f76

Contents?: true

Size: 881 Bytes

Versions: 10

Compression:

Stored size: 881 Bytes

Contents

require "rails_helper"

RSpec.describe Dorsale::PolymorphicId do
  it "should return guid" do
    task = create(:flyboy_task)
    expect(task.id).to be_present
    expect(task.guid).to eq "Dorsale::Flyboy::Task-#{task.id}"
  end

  it "should return guid" do
    folder = create(:flyboy_folder)
    task   = build(:flyboy_task, taskable: nil)

    expect(folder.id).to be_present
    expect(task.taskable).to be_nil
    expect(task.taskable_id).to be_nil
    expect(task.taskable_type).to be_nil
    task.taskable_guid = folder.guid
    expect(task.taskable).to eq folder
    expect(task.taskable_id).to eq folder.id
    expect(task.taskable_type).to eq "Dorsale::Flyboy::Folder"
  end

  it "should return base_class in guid" do
    corporation = create(:customer_vault_corporation)
    expect(corporation.guid).to eq "Dorsale::CustomerVault::Person-#{corporation.id}"
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dorsale-3.3.0 spec/libs/dorsale/polymorphic_id_spec.rb
dorsale-3.2.0 spec/libs/dorsale/polymorphic_id_spec.rb
dorsale-3.1.7 spec/lib/polymorphic_id_spec.rb
dorsale-3.1.6 spec/lib/polymorphic_id_spec.rb
dorsale-3.1.5 spec/lib/polymorphic_id_spec.rb
dorsale-3.1.4 spec/lib/polymorphic_id_spec.rb
dorsale-3.1.3 spec/lib/polymorphic_id_spec.rb
dorsale-3.1.2 spec/lib/polymorphic_id_spec.rb
dorsale-3.1.1 spec/lib/polymorphic_id_spec.rb
dorsale-3.1.0 spec/lib/polymorphic_id_spec.rb