mirror of
https://github.com/discourse/discourse-rewind.git
synced 2025-07-07 06:12:22 +00:00
DEV: fix spec failure (#13)
Reports are only returned in december and january, so since we move into february the spec was failing.
This commit is contained in:
parent
0b7de95705
commit
ffdd50cc65
@ -2,13 +2,13 @@
|
||||
|
||||
RSpec.describe(DiscourseRewind::FetchReports) do
|
||||
describe ".call" do
|
||||
subject(:result) { described_class.call(**dependencies) }
|
||||
|
||||
fab!(:current_user) { Fabricate(:user) }
|
||||
|
||||
let(:guardian) { Guardian.new(current_user) }
|
||||
let(:dependencies) { { guardian: } }
|
||||
|
||||
subject(:result) { described_class.call(**dependencies) }
|
||||
|
||||
context "when in january" do
|
||||
before { freeze_time DateTime.parse("2021-01-22") }
|
||||
|
||||
@ -32,12 +32,14 @@ RSpec.describe(DiscourseRewind::FetchReports) do
|
||||
end
|
||||
|
||||
context "when reports is cached" do
|
||||
before { freeze_time DateTime.parse("2021-12-22") }
|
||||
|
||||
it "returns the cached reports" do
|
||||
expect(result.reports.length).to eq(9)
|
||||
|
||||
expect(DiscourseRewind::Action::TopWords).not_to receive(:call)
|
||||
|
||||
allow(DiscourseRewind::Action::TopWords).to receive(:call)
|
||||
expect(result.reports.length).to eq(9)
|
||||
expect(DiscourseRewind::Action::TopWords).to_not have_received(:call)
|
||||
end
|
||||
end
|
||||
|
||||
@ -48,8 +50,9 @@ RSpec.describe(DiscourseRewind::FetchReports) do
|
||||
end
|
||||
|
||||
it "returns the reports" do
|
||||
expect(DiscourseRewind::Action::TopWords).to receive(:call)
|
||||
allow(DiscourseRewind::Action::TopWords).to receive(:call)
|
||||
expect(result.reports.length).to eq(9)
|
||||
expect(DiscourseRewind::Action::TopWords).to have_received(:call)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user