Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed up some specs

  • Loading branch information...
commit ae7fa87a1309793effd6ff32ff8aee89abe46b59 1 parent 8cff841
Ben Alavi benalavi authored
11 lib/is_taggable.rb
... ... @@ -1,6 +1,5 @@
1   -require 'acts_as_taggable_on/acts_as_taggable_on'
2   -require 'acts_as_taggable_on/acts_as_tagger'
3   -require 'acts_as_taggable_on/tag'
4   -require 'acts_as_taggable_on/tag_list'
5   -require 'acts_as_taggable_on/tags_helper'
6   -require 'acts_as_taggable_on/tagging'
  1 +require 'is_taggable/is_taggable'
  2 +require 'is_taggable/is_tagger'
  3 +require 'is_taggable/tag_list'
  4 +require 'is_taggable/tags_helper'
  5 +require 'is_taggable/tagging'
7 spec/acts_as_taggable_on/tagging_spec.rb
... ... @@ -1,7 +0,0 @@
1   -require File.dirname(__FILE__) + '/../spec_helper'
2   -
3   -describe Tagging do
4   - before(:each) do
5   - @tagging = Tagging.new
6   - end
7   -end
2  spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb → spec/is_taggable/is_taggable_spec.rb
... ... @@ -1,6 +1,6 @@
1 1 require File.dirname(__FILE__) + '/../spec_helper'
2 2
3   -describe "Acts As Taggable On" do
  3 +describe "Is Taggable" do
4 4 it "should provide a class method 'taggable?' that is false for untaggable models" do
5 5 UntaggableModel.should_not be_taggable
6 6 end
2  spec/acts_as_taggable_on/acts_as_tagger_spec.rb → spec/is_taggable/is_tagger_spec.rb
... ... @@ -1,6 +1,6 @@
1 1 require File.dirname(__FILE__) + '/../spec_helper'
2 2
3   -describe "acts_as_tagger" do
  3 +describe "is_tagger" do
4 4 context "Tagger Method Generation" do
5 5
6 6 before(:each) do
0  spec/acts_as_taggable_on/tag_list_spec.rb → spec/is_taggable/tag_list_spec.rb
File renamed without changes
0  spec/acts_as_taggable_on/taggable_spec.rb → spec/is_taggable/taggable_spec.rb
File renamed without changes
0  spec/acts_as_taggable_on/tagger_spec.rb → spec/is_taggable/tagger_spec.rb
File renamed without changes
9 spec/acts_as_taggable_on/tag_spec.rb → spec/is_taggable/tagging_spec.rb
... ... @@ -1,11 +1,10 @@
1 1 require File.dirname(__FILE__) + '/../spec_helper'
2 2
3   -describe Tag do
  3 +describe Tagging do
4 4 before(:each) do
5   - @tag = Tag.new
6   - @user = TaggableModel.create(:name => "Pablo")
  5 + @tagging = Tagging.new
7 6 end
8   -
  7 +
9 8 it "should require a name" do
10 9 @tag.should have(1).errors_on(:name)
11 10 @tag.name = "something"
@@ -22,4 +21,4 @@
22 21 @tag.name = "cool"
23 22 @tag.to_s.should == "cool"
24 23 end
25   -end
  24 +end
6 spec/schema.rb
@@ -4,6 +4,7 @@
4 4 t.integer "taggable_id", :limit => 11
5 5 t.string "taggable_type"
6 6 t.string "context"
  7 + t.string "tag"
7 8 t.datetime "created_at"
8 9 t.integer "tagger_id", :limit => 11
9 10 t.string "tagger_type"
@@ -11,10 +12,7 @@
11 12
12 13 add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
13 14 add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
14   -
15   - create_table "tags", :force => true do |t|
16   - t.string "name"
17   - end
  15 + add_index "taggings", ["taggable_id", "taggable_type", "context", "tag"], :name => "index_taggings_on_taggable_and_context_and_tag", :uniq => true
18 16
19 17 create_table :taggable_models, :force => true do |t|
20 18 t.column :name, :string
14 spec/spec_helper.rb
... ... @@ -1,4 +1,6 @@
1 1 require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
  2 +# hack the require with absolute path like this for now...
  3 +#require '/Users/benalavi/Sites/causecast/spec/spec_helper'
2 4
3 5 module Spec::Example::ExampleGroupMethods
4 6 alias :context :describe
@@ -10,24 +12,24 @@ module Spec::Example::ExampleGroupMethods
10 12 load(File.dirname(__FILE__) + '/schema.rb')
11 13
12 14 class TaggableModel < ActiveRecord::Base
13   - acts_as_taggable_on :tags, :languages
14   - acts_as_taggable_on :skills
  15 + is_taggable :tags, :languages
  16 + is_taggable :skills
15 17 end
16 18
17 19 class OtherTaggableModel < ActiveRecord::Base
18   - acts_as_taggable_on :tags, :languages
  20 + is_taggable :tags, :languages
19 21 end
20 22
21 23 class InheritingTaggableModel < TaggableModel
22 24 end
23 25
24 26 class AlteredInheritingTaggableModel < TaggableModel
25   - acts_as_taggable_on :parts
  27 + is_taggable :parts
26 28 end
27 29
28 30 class TaggableUser < ActiveRecord::Base
29   - acts_as_tagger
  31 + is_tagger
30 32 end
31 33
32 34 class UntaggableModel < ActiveRecord::Base
33   -end
  35 +end

0 comments on commit ae7fa87

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