add test cases
This commit is contained in:
@@ -44,6 +44,8 @@ class NoteTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
assert_equal(1, @note.versions.count)
|
assert_equal(1, @note.versions.count)
|
||||||
assert_equal(@note.body, @note.versions.first.body)
|
assert_equal(@note.body, @note.versions.first.body)
|
||||||
|
assert_equal(1, @note.version)
|
||||||
|
assert_equal(1, @note.versions.first.version)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "update the post's last_noted_at field" do
|
should "update the post's last_noted_at field" do
|
||||||
@@ -92,7 +94,9 @@ class NoteTest < ActiveSupport::TestCase
|
|||||||
@note.update_attributes(:body => "fafafa")
|
@note.update_attributes(:body => "fafafa")
|
||||||
end
|
end
|
||||||
assert_equal(2, @note.versions.count)
|
assert_equal(2, @note.versions.count)
|
||||||
|
assert_equal(2, @note.versions.last.version)
|
||||||
assert_equal("fafafa", @note.versions.last.body)
|
assert_equal("fafafa", @note.versions.last.body)
|
||||||
|
assert_equal(2, @note.version)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "for a note-locked post" do
|
context "for a note-locked post" do
|
||||||
|
|||||||
@@ -765,6 +765,20 @@ class PostTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "Paginating:" do
|
||||||
|
setup do
|
||||||
|
CurrentUser.user.stubs(:per_page).returns(3)
|
||||||
|
4.times do
|
||||||
|
FactoryGirl.create(:post)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
should "delegate the default limit to the user" do
|
||||||
|
posts = Post.tag_match("").paginate(1).all
|
||||||
|
assert_equal(3, posts.size)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "Searching:" do
|
context "Searching:" do
|
||||||
should "return posts for the ' tag" do
|
should "return posts for the ' tag" do
|
||||||
post1 = FactoryGirl.create(:post, :tag_string => "'")
|
post1 = FactoryGirl.create(:post, :tag_string => "'")
|
||||||
|
|||||||
Reference in New Issue
Block a user