Sha256: 581f407f279c0b2e5315d17f2e0857f7f6a1d5ca6ea3dfead619ff3f6775ed37

Contents?: true

Size: 952 Bytes

Versions: 12

Compression:

Stored size: 952 Bytes

Contents

RSpec.describe Sufia::UserProfilePresenter do
  let(:user) { create(:user) }
  let(:ability) { Ability.new(user) }
  let(:presenter) { described_class.new(user, ability) }

  describe "current_user?" do
    subject { presenter.current_user? }
    it { is_expected.to be true }
  end

  describe "trophies" do
    let(:work1) { create(:work, user: user) }
    let(:work2) { create(:work, user: user) }
    let(:work3) { create(:work, user: user) }
    let!(:trophy1) { user.trophies.create!(work_id: work1.id) }
    let!(:trophy2) { user.trophies.create!(work_id: work2.id) }
    let!(:trophy3) { user.trophies.create!(work_id: work3.id) }
    let!(:badtrophy) { user.trophies.create!(work_id: 'not_a_generic_work') }
    subject { presenter.trophies }

    it "has an array of presenters" do
      expect(subject).to all(be_kind_of Sufia::TrophyPresenter)
      expect(subject.map(&:id)).to match_array [work1.id, work2.id, work3.id]
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
sufia-7.4.1 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.4.0 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.3.1 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.3.0 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.3.0.rc3 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.3.0.rc2 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.3.0.rc1 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.2.0 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.1.0 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.0.0 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.0.0.rc2 spec/presenters/sufia/user_profile_presenter_spec.rb
sufia-7.0.0.rc1 spec/presenters/sufia/user_profile_presenter_spec.rb