mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-04 16:28:50 +01:00
Add test for tag cloud query
This commit is contained in:
parent
a81f5b76f3
commit
63fb7a589c
1 changed files with 31 additions and 0 deletions
31
test/unit/tag_cloud_query_test.rb
Normal file
31
test/unit/tag_cloud_query_test.rb
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
||||
|
||||
class TagCloudQueryTest < ActiveSupport::TestCase
|
||||
|
||||
fixtures :tags, :taggings, :users
|
||||
|
||||
def user
|
||||
@user ||= User.find 1
|
||||
end
|
||||
|
||||
def test_get_all_tags
|
||||
tags = Stats::TagCloudQuery.new(user).result
|
||||
assert_equal 2, tags.size
|
||||
tags.sort_by! {|t| t.id}
|
||||
tag = tags.first
|
||||
assert_equal 3, tag.count
|
||||
assert_equal "foo", tag.name
|
||||
|
||||
tag = tags.last
|
||||
assert_equal 1, tag.count
|
||||
assert_equal "bar", tag.name
|
||||
end
|
||||
|
||||
def test_get_subset_of_tags
|
||||
tags = Stats::TagCloudQuery.new(user, 1.week.ago).result
|
||||
|
||||
assert_equal 1, tags.size
|
||||
assert_equal 2, tags.first.count
|
||||
assert_equal "foo", tags.first.name
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue