We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 92dbda5 commit debfec8Copy full SHA for debfec8
1 file changed
spec/filtering_spec.rb
@@ -12,7 +12,7 @@
12
end
13
14
15
- context 'attributes with underscore in name' do
+ context 'handle attributes with underscore in name' do
16
it 'detect _' do
17
attributes, predicates = JSONAPI::Filtering
18
.extract_attributes_and_predicates('notes_count_eq')
@@ -103,6 +103,13 @@
103
}
104
105
106
+ it 'ensures ransack scopes work properly' do
107
+ ransack = User.ransack(notes_count_eq: 1)
108
+ expected_sql = 'SELECT "users".* FROM "users" WHERE '\
109
+ '"users"."notes_count" = 1'
110
+ expect(ransack.result.to_sql).to eq(expected_sql)
111
+ end
112
+
113
it do
114
expect(first_user.notes_count).to eq(0)
115
expect(second_user.notes_count).to eq(1)
0 commit comments