Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rails2-style fixtures

Signed-off-by: Jonathan Viney <jonathan.viney@gmail.com>
  • Loading branch information...
commit 3a9110fc3a77b8755ad52fad78ef552cd2d2a885 1 parent 8f43635
Jonas Wagner authored committed
View
2  Rakefile
@@ -7,7 +7,7 @@ task :default => :test
desc 'Test the acts_as_taggable_on_steroids plugin.'
Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
+ t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
View
4 test/fixtures/magazines.yml
@@ -1,7 +1,5 @@
ruby:
- id: 1
name: Ruby
rails:
- id: 2
- name: Rails
+ name: Rails
View
15 test/fixtures/photos.yml
@@ -1,24 +1,19 @@
jonathan_dog:
- id: 1
- user_id: 1
+ user: jonathan
title: A small dog
jonathan_questioning_dog:
- id: 2
- user_id: 1
+ user: jonathan
title: What does this dog want?
jonathan_bad_cat:
- id: 3
- user_id: 1
+ user: jonathan
title: Bad cat
sam_flower:
- id: 4
- user_id: 2
+ user: sam
title: Flower
sam_sky:
- id: 5
- user_id: 2
+ user: sam
title: Sky
View
23 test/fixtures/posts.yml
@@ -1,34 +1,27 @@
jonathan_sky:
- id: 1
- user_id: 1
+ user: jonathan
text: The sky is particularly blue today
jonathan_grass:
- id: 2
- user_id: 1
+ user: jonathan
text: The grass seems very green
jonathan_rain:
- id: 3
- user_id: 1
+ user: jonathan
text: Why does the rain fall?
jonathan_cloudy:
- id: 4
- user_id: 1
+ user: jonathan
text: Is it cloudy?
jonathan_still_cloudy:
- id: 5
- user_id: 1
+ user: jonathan
text: Is it still cloudy?
sam_ground:
- id: 6
- user_id: 2
+ user: sam
text: The ground is looking too brown
sam_flowers:
- id: 7
- user_id: 2
- text: Why are the flowers dead?
+ user: sam
+ text: Why are the flowers dead?
View
4 test/fixtures/subscriptions.yml
@@ -1,3 +1,3 @@
jonathan_rails:
- user_id: 1
- magazine_id: 1
+ user: jonathan
+ magazine: ruby
View
128 test/fixtures/taggings.yml
@@ -1,149 +1,107 @@
# Posts
jonathan_sky_good:
- id: 1
- tag_id: 1
- taggable_id: 1
- taggable_type: Post
+ tag: good
+ taggable: jonathan_sky (Post)
created_at: 2006-08-01
jonathan_sky_nature:
- id: 2
- tag_id: 3
- taggable_id: 1
- taggable_type: Post
+ tag: nature
+ taggable: jonathan_sky (Post)
created_at: 2006-08-02
jonathan_grass_nature:
- id: 3
- tag_id: 3
- taggable_id: 2
- taggable_type: Post
+ tag: nature
+ taggable: jonathan_grass (Post)
created_at: 2006-08-03
jonathan_rain_question:
- id: 4
- tag_id: 4
- taggable_id: 3
- taggable_type: Post
+ tag: question
+ taggable: jonathan_rain (Post)
created_at: 2006-08-04
jonathan_rain_nature:
- id: 5
- tag_id: 3
- taggable_id: 3
- taggable_type: Post
+ tag: nature
+ taggable: jonathan_rain (Post)
created_at: 2006-08-05
jonathan_cloudy_nature:
- id: 6
- tag_id: 3
- taggable_id: 4
- taggable_type: Post
+ tag: nature
+ taggable: jonathan_cloudy (Post)
created_at: 2006-08-06
jonathan_still_cloudy_nature:
- id: 7
- tag_id: 3
- taggable_id: 5
- taggable_type: Post
+ tag: nature
+ taggable: jonathan_still_cloudy (Post)
created_at: 2006-08-07
sam_ground_nature:
- id: 8
- tag_id: 3
- taggable_id: 6
- taggable_type: Post
+ tag: nature
+ taggable: sam_ground (Post)
created_at: 2006-08-08
sam_ground_bad:
- id: 9
- tag_id: 2
- taggable_id: 6
- taggable_type: Post
+ tag: bad
+ taggable: sam_ground (Post)
created_at: 2006-08-09
sam_flowers_good:
- id: 10
- tag_id: 1
- taggable_id: 7
- taggable_type: Post
+ tag: good
+ taggable: sam_flowers (Post)
created_at: 2006-08-10
sam_flowers_nature:
- id: 11
- tag_id: 3
- taggable_id: 7
- taggable_type: Post
+ tag: nature
+ taggable: sam_flowers (Post)
created_at: 2006-08-11
# Photos
jonathan_dog_animal:
- id: 12
- tag_id: 5
- taggable_id: 1
- taggable_type: Photo
+ tag: animal
+ taggable: jonathan_dog (Photo)
created_at: 2006-08-12
-
+
jonathan_dog_nature:
- id: 13
- tag_id: 3
- taggable_id: 1
- taggable_type: Photo
+ tag: nature
+ taggable: jonathan_dog (Photo)
created_at: 2006-08-13
jonathan_questioning_dog_animal:
- id: 14
- tag_id: 5
- taggable_id: 2
- taggable_type: Photo
+ tag: animal
+ taggable: jonathan_questioning_dog (Photo)
created_at: 2006-08-14
jonathan_questioning_dog_question:
- id: 15
- tag_id: 4
- taggable_id: 2
- taggable_type: Photo
+ tag: question
+ taggable: jonathan_questioning_dog (Photo)
created_at: 2006-08-15
jonathan_bad_cat_bad:
- id: 16
- tag_id: 2
- taggable_id: 3
- taggable_type: Photo
+ tag: bad
+ taggable: jonathan_bad_cat (Photo)
created_at: 2006-08-16
jonathan_bad_cat_animal:
- id: 17
- tag_id: 5
- taggable_id: 3
- taggable_type: Photo
+ tag: animal
+ taggable: jonathan_bad_cat (Photo)
created_at: 2006-08-17
sam_flower_nature:
- id: 18
- tag_id: 3
- taggable_id: 4
- taggable_type: Photo
+ tag: nature
+ taggable: sam_flower (Photo)
created_at: 2006-08-18
sam_flower_good:
- id: 19
- tag_id: 1
- taggable_id: 4
- taggable_type: Photo
+ tag: good
+ taggable: sam_flower (Photo)
created_at: 2006-08-19
sam_sky_nature:
- id: 20
- tag_id: 3
- taggable_id: 5
- taggable_type: Photo
+ tag: nature
+ taggable: sam_sky (Photo)
created_at: 2006-08-20
# Magazines
ruby_good:
- id: 50
- tag_id: 1
- taggable_id: 1
- taggable_type: Magazine
+ tag: good
+ taggable: ruby (Magazine)
created_at: 2007-08-25
View
7 test/fixtures/tags.yml
@@ -1,19 +1,14 @@
good:
- id: 1
name: Very good
bad:
- id: 2
name: Bad
nature:
- id: 3
name: Nature
question:
- id: 4
name: Question
animal:
- id: 5
- name: Crazy animal
+ name: Crazy animal
View
2  test/fixtures/users.yml
@@ -1,7 +1,5 @@
jonathan:
- id: 1
name: Jonathan
sam:
- id: 2
name: Sam
View
2  test/tag_test.rb
@@ -27,7 +27,7 @@ def test_to_s
def test_equality
assert_equal tags(:good), tags(:good)
- assert_equal Tag.find(1), Tag.find(1)
+ assert_equal Tag.find(tags(:good).id), Tag.find(tags(:good).id)
assert_equal Tag.new(:name => 'A'), Tag.new(:name => 'A')
assert_not_equal Tag.new(:name => 'A'), Tag.new(:name => 'B')
end
View
11 test/tags_helper_test.rb
@@ -12,12 +12,11 @@ def test_tag_cloud
cloud_elements << [tag, css_class]
end
- assert_equal [
- [tags(:good), "css2"],
- [tags(:bad), "css1"],
- [tags(:nature), "css4"],
- [tags(:question), "css1"]
- ], cloud_elements
+ assert cloud_elements.include?([tags(:good), "css2"])
+ assert cloud_elements.include?([tags(:bad), "css1"])
+ assert cloud_elements.include?([tags(:nature), "css4"])
+ assert cloud_elements.include?([tags(:question), "css1"])
+ assert_equal 4, cloud_elements.size
end
def test_tag_cloud_when_no_tags
Please sign in to comment.
Something went wrong with that request. Please try again.