mirror of
https://github.com/discourse/discourse-rewind.git
synced 2025-07-07 14:22:12 +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
|
RSpec.describe(DiscourseRewind::FetchReports) do
|
||||||
describe ".call" do
|
describe ".call" do
|
||||||
|
subject(:result) { described_class.call(**dependencies) }
|
||||||
|
|
||||||
fab!(:current_user) { Fabricate(:user) }
|
fab!(:current_user) { Fabricate(:user) }
|
||||||
|
|
||||||
let(:guardian) { Guardian.new(current_user) }
|
let(:guardian) { Guardian.new(current_user) }
|
||||||
let(:dependencies) { { guardian: } }
|
let(:dependencies) { { guardian: } }
|
||||||
|
|
||||||
subject(:result) { described_class.call(**dependencies) }
|
|
||||||
|
|
||||||
context "when in january" do
|
context "when in january" do
|
||||||
before { freeze_time DateTime.parse("2021-01-22") }
|
before { freeze_time DateTime.parse("2021-01-22") }
|
||||||
|
|
||||||
@ -32,12 +32,14 @@ RSpec.describe(DiscourseRewind::FetchReports) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when reports is cached" do
|
context "when reports is cached" do
|
||||||
|
before { freeze_time DateTime.parse("2021-12-22") }
|
||||||
|
|
||||||
it "returns the cached reports" do
|
it "returns the cached reports" do
|
||||||
expect(result.reports.length).to eq(9)
|
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(result.reports.length).to eq(9)
|
||||||
|
expect(DiscourseRewind::Action::TopWords).to_not have_received(:call)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -48,8 +50,9 @@ RSpec.describe(DiscourseRewind::FetchReports) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "returns the reports" do
|
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(result.reports.length).to eq(9)
|
||||||
|
expect(DiscourseRewind::Action::TopWords).to have_received(:call)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user