@@ -29,8 +29,10 @@ RSpec.describe Gitlab::Insights::Reducers::CountPerPeriodReducer do
let(:expected)do
{
'January 2019'=>1,
'February 2019'=>1,
'March 2019'=>1
'February 2019'=>0,
'March 2019'=>1,
'April 2019'=>1,
'May 2019'=>0
}
end
...
...
@@ -39,7 +41,11 @@ RSpec.describe Gitlab::Insights::Reducers::CountPerPeriodReducer do
end
it'raises an error for an unknown :period_field option'do
expect{reduce(issuable_relation,'month',:foo)}.toraise_error(described_class::InvalidPeriodFieldError,"Invalid value for `period_field`: `foo`. Allowed values are #{described_class::VALID_PERIOD_FIELD}!")
expect{reduce(issuable_relation,'month',5,:foo)}.toraise_error(described_class::InvalidPeriodFieldError,"Invalid value for `period_field`: `foo`. Allowed values are #{described_class::VALID_PERIOD_FIELD}!")
end
it'raises an error for an unknown :period_limit option'do
expect{reduce(issuable_relation,'month',-1)}.toraise_error(described_class::InvalidPeriodLimitError,"Invalid value for `period_limit`: `-1`. Value must be greater than 0!")
end
it'returns issuables with only the needed fields'do