Commit d86920a554daabfea4ad0454999c8dbee50e83b0

Authored by Andrew Kane
1 parent 1eaa924f
Exists in sqlite

Working tests

Showing 2 changed files with 17 additions and 3 deletions   Show diff stats
test/sqlite_test.rb
... ... @@ -12,4 +12,18 @@ class TestSqlite < Minitest::Test
12 12 true
13 13 end
14 14 end
  15 +
  16 + def test_where_after
  17 + skip
  18 + end
  19 +
  20 + def call_method(method, field, options)
  21 + if method == :quarter || options[:time_zone] || options[:day_start] || options[:week_start] || Groupdate.week_start != :sun || (Time.zone && options[:time_zone] != false)
  22 + error = assert_raises(Groupdate::Error) { super }
  23 + assert_includes error.message, "not supported for SQLite"
  24 + skip # after assertions
  25 + else
  26 + super
  27 + end
  28 + end
15 29 end
... ...
test/test_helper.rb
... ... @@ -235,7 +235,7 @@ module TestDatabase
235 235 last_month.to_date => 0,
236 236 this_month.to_date => 1
237 237 }
238   - assert_equal expected, User.group_by_month(:created_on, last: 2).count
  238 + assert_equal expected, call_method(:month, :created_on, last: 2)
239 239 ensure
240 240 Time.zone = nil
241 241 end
... ... @@ -264,7 +264,7 @@ module TestDatabase
264 264 last_quarter.to_date => 0,
265 265 this_quarter.to_date => 1
266 266 }
267   - assert_equal expected, User.group_by_quarter(:created_at, last: 2).count
  267 + assert_equal expected, call_method(:quarter, :created_at, last: 2)
268 268 end
269 269  
270 270 def test_format_locale
... ... @@ -369,7 +369,7 @@ module TestDatabase
369 369 Date.parse("2014-10-19") => 1,
370 370 Date.parse("2014-10-20") => 1
371 371 }
372   - assert_equal expected, User.group_by_day(:created_at, time_zone: "Brasilia").count
  372 + assert_equal expected, call_method(:day, :created_at, time_zone: "Brasilia")
373 373 end
374 374  
375 375 # carry_forward option
... ...