Skip to content
Browse files

Fixed tests due to erroneous entry in the fixtures, and tags expected…

… to be in a particular order
  • Loading branch information...
1 parent 401f808 commit d8013cf89382d07810d171d3a5cddd90408655cf @skwp skwp committed May 13, 2008
Showing with 4 additions and 11 deletions.
  1. +2 −2 lib/acts_as_taggable.rb
  2. +1 −1 test/acts_as_taggable_test.rb
  3. +1 −8 test/fixtures/taggings.yml
View
4 lib/acts_as_taggable.rb
@@ -8,7 +8,7 @@ def self.included(base)
module ClassMethods
def acts_as_taggable(options = {})
has_many :taggings, :as => :taggable, :dependent => :destroy, :include => :tag
- has_many :tags, :through => :taggings
+ has_many :tags, :through => :taggings, :order => 'name asc'
after_save :update_tags
@@ -72,7 +72,7 @@ def user_id=(new_user_id)
def tag_list(user = nil)
unless user
- tags.collect { |tag| tag.name.include?(" ") ? %("#{tag.name}") : tag.name }.join(" ")
+ resiult = tags.collect { |tag| tag.name.include?(" ") ? %("#{tag.name}") : tag.name }.join(" ")
else
tags.delete_if { |tag| !user.tags.include?(tag) }.collect { |tag| tag.name.include?(" ") ? %("#{tag.name}") : tag.name }.join(" ")
end
View
2 test/acts_as_taggable_test.rb
@@ -29,6 +29,6 @@ def test_update_tags
things(:bear).tag_list = 'animal "not green" favorite'
assert_equal things(:bear).tag_list, "animal \"not green\""
things(:bear).update_tags
- assert_equal things(:bear).tag_list, "animal \"not green\" favorite"
+ assert_equal things(:bear).tag_list, "animal favorite \"not green\""
end
end
View
9 test/fixtures/taggings.yml
@@ -44,11 +44,4 @@ orange_not_green:
id: 8
taggable_id: 4
taggable_type: Thing
- tag_id: 4
-
-monki_bear_favorite:
- id: 9
- taggable_id: 1
- taggable_type: Thing
- tag_id: 5
- user_id: 1
+ tag_id: 4

0 comments on commit d8013cf

Please sign in to comment.
Something went wrong with that request. Please try again.