test/hightop_test.rb in hightop-0.1.2 vs test/hightop_test.rb in hightop-0.1.3
- old
+ new
@@ -1,9 +1,8 @@
require_relative "test_helper"
class TestHightop < Minitest::Test
-
def setup
Visit.delete_all
end
def test_top
@@ -30,11 +29,11 @@
def test_nil_values
create_city("San Francisco", 3)
create_city(nil, 2)
expected = {
- "San Francisco" => 3,
+ "San Francisco" => 3
}
assert_equal expected, Visit.top(:city)
end
def test_nil_option
@@ -62,12 +61,12 @@
}
assert_equal expected, Visit.top("LOWER(city)")
end
def test_uniq
- create({city: "San Francisco", user_id: 1})
- create({city: "San Francisco", user_id: 1})
+ create(city: "San Francisco", user_id: 1)
+ create(city: "San Francisco", user_id: 1)
expected = {
"San Francisco" => 1
}
assert_equal expected, Visit.top(:city, uniq: :user_id)
end
@@ -84,9 +83,8 @@
def create_city(city, count = 1)
create({city: city}, count)
end
def create(attributes, count = 1)
- count.times{ Visit.create!(attributes) }
+ count.times { Visit.create!(attributes) }
end
-
end