Skip to content

Commit 0cb3d26

Browse files
author
Lee Richmond
committed
Add friendly error spec
1 parent f4bafdf commit 0cb3d26

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

spec/stats_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,12 @@ def index
169169
expect(json['meta']['stats']).to eq({ 'total' => { 'count' => 1 } })
170170
end
171171
end
172+
173+
context 'when requested stat not configured' do
174+
it 'raises error' do
175+
expect {
176+
get :index, params: { stats: { asdf: :count} }
177+
}.to raise_error(JsonapiCompliable::Errors::StatNotFound, "No stat configured for calculation :count on attribute 'asdf'")
178+
end
179+
end
172180
end

0 commit comments

Comments
 (0)