Skip to content

Commit

Permalink
Add specs for value_before_type_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
tmaier authored and ches committed Jul 17, 2012
1 parent 0406c14 commit 4479181
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/mongoid/taggable_spec.rb
Expand Up @@ -117,6 +117,11 @@ class Post
article.keywords = "some,new,tag"
article.keywords.should == %w[some new tag]
end

it "#keywords_before_type_cast" do
article.keywords = "some,new,tag"
article.keywords_before_type_cast.should eq "some, new, tag"
end
end

context "changing separator" do
Expand Down Expand Up @@ -239,6 +244,12 @@ class Post
end
end

context "#tags_before_type_cast" do
subject { MyModel.new(:tags => %w[some new tag]) }

its(:tags_before_type_cast) { should eq "some, new, tag" }
end

context "#self.tagged_with" do
let!(:models) do
[
Expand Down Expand Up @@ -287,6 +298,11 @@ class Post
Article.keywords_with_weight.should include(['satire', 3])
Editorial.keywords_with_weight.should include(['satire', 3])
end

it "#keywords_before_type_cast" do
editorial.keywords = %w[some new tag]
editorial.keywords_before_type_cast.should eq "some new tag"
end
end

context "using taggable module along with other mongoid modules" do
Expand Down

0 comments on commit 4479181

Please sign in to comment.