Skip to content

Commit

Permalink
Merge pull request #51 from theablefew/esmarkowski/remove-sort-from-`…
Browse files Browse the repository at this point in the history
…count`

Remove sort from `.count` method
  • Loading branch information
esmarkowski authored Mar 10, 2024
2 parents 3794428 + 1967373 commit 9ead9bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/stretchy/relations/finder_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def count
def count!
@values[:count] = true
@values.delete(:size)
spawn.results
spawned = spawn
spawned.order_values.clear
spawned.results
end

end
Expand Down
4 changes: 4 additions & 0 deletions spec/stretchy/querying_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@
expect(described_class.count).to be_a(Integer)
expect(described_class.count).to eq(19)
end

it 'removes order from count' do
expect(described_class.order(age: :asc).count).to eq(19)
end
end

context '.where' do
Expand Down

0 comments on commit 9ead9bd

Please sign in to comment.