Skip to content

Commit

Permalink
Updates tests where mock_model errs.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwatson78 authored and tamsin johnson committed Nov 7, 2023
1 parent 8e3a4cd commit fe97a1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion spec/models/file_view_stat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
let(:user_id) { 123 }
let(:date) { Time.current }
let(:file_stat) { described_class.create(views: "25", date: date, file_id: file_id, user_id: user_id) }
let(:file) { mock_model(FileSet, id: 99) }
let(:file) { mock_model('MockFileSet', id: 99) }

it "has attributes" do
expect(file_stat).to respond_to(:views)
Expand Down
8 changes: 4 additions & 4 deletions spec/models/work_view_stat_spec.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# frozen_string_literal: true
RSpec.describe WorkViewStat, type: :model do
RSpec.describe WorkViewStat, :clean_repo, type: :model do
let(:work_id) { work.id }
let(:user_id) { 123 }
let(:date) { DateTime.new.in_time_zone }
let(:work_stat) { described_class.create(work_views: "25", date: date, work_id: work_id, user_id: user_id) }
let(:work) { mock_model(GenericWork, id: 199) }
let(:work) { valkyrie_create(:monograph) }

it "has attributes" do
expect(work_stat).to respond_to(:work_views)
expect(work_stat).to respond_to(:date)
expect(work_stat).to respond_to(:work_id)
expect(work_stat.work_id).to eq("199")
expect(work_stat.work_id).to eq(work_id)
expect(work_stat.date).to eq(date)
expect(work_stat.work_views).to eq(25)
expect(work_stat.user_id).to eq(user_id)
end

describe ".ga_statistic" do
let(:start_date) { 2.days.ago }
let(:expected_path) { Rails.application.routes.url_helpers.hyrax_generic_work_path(work) }
let(:expected_path) { "/concern/monographs/#{work_id}" }

before do
allow(Hyrax::Analytics).to receive(:profile).and_return(profile)
Expand Down

0 comments on commit fe97a1f

Please sign in to comment.