Sha256: 8feba7fdda865b1e27cce6c9541602320ef10550a7f583bc3c63ede9151f3ae6

Contents?: true

Size: 565 Bytes

Versions: 23

Compression:

Stored size: 565 Bytes

Contents

describe Trophy, type: :model do
  let(:trophy) { described_class.create(user_id: 99, work_id: "99") }

  it "has a user" do
    expect(trophy).to respond_to(:user_id)
    expect(trophy.user_id).to eq(99)
  end

  it "has a work" do
    expect(trophy).to respond_to(:work_id)
    expect(trophy.work_id).to eq("99")
  end

  it "does not allow six trophies" do
    (1..6).each { |n| described_class.create(user_id: 120, work_id: n.to_s) }
    expect(described_class.where(user_id: 120).count).to eq(5)
    described_class.where(user_id: 120).map(&:delete)
  end
end

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
sufia-7.0.0.rc2 spec/models/trophy_spec.rb
sufia-7.0.0.rc1 spec/models/trophy_spec.rb
sufia-7.0.0.beta4 spec/models/trophy_spec.rb