fixes #1396, fix tests
This commit is contained in:
@@ -40,8 +40,8 @@ class ArtistUrlTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "normalize pixiv urls" do
|
||||
url = FactoryGirl.create(:artist_url, :url => "http://img55.pixiv.net/monet")
|
||||
assert_equal("http://img55.pixiv.net/monet", url.url)
|
||||
url = FactoryGirl.create(:artist_url, :url => "http://img55.pixiv.net/img/monet")
|
||||
assert_equal("http://img55.pixiv.net/img/monet", url.url)
|
||||
assert_equal("http://img.pixiv.net/monet/", url.normalized_url)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,13 @@ class NoteTest < ActiveSupport::TestCase
|
||||
|
||||
context "creating a note" do
|
||||
setup do
|
||||
@post = FactoryGirl.create(:post)
|
||||
@post = FactoryGirl.create(:post, :image_width => 1000, :image_height => 1000)
|
||||
end
|
||||
|
||||
should "not validate if the note is outside the image" do
|
||||
@note = FactoryGirl.build(:note, :x => 1001, :y => 500, :post => @post)
|
||||
@note.save
|
||||
assert_equal(["Coordinates must be inside the image"], @note.errors.full_messages)
|
||||
end
|
||||
|
||||
should "create a version" do
|
||||
@@ -72,7 +78,7 @@ class NoteTest < ActiveSupport::TestCase
|
||||
|
||||
context "updating a note" do
|
||||
setup do
|
||||
@post = FactoryGirl.create(:post)
|
||||
@post = FactoryGirl.create(:post, :image_width => 1000, :image_height => 1000)
|
||||
@note = FactoryGirl.create(:note, :post => @post)
|
||||
end
|
||||
|
||||
@@ -84,7 +90,7 @@ class NoteTest < ActiveSupport::TestCase
|
||||
|
||||
should "update the post's last_noted_at field" do
|
||||
assert_nil(@post.last_noted_at)
|
||||
@note.update_attributes(:x => 1000)
|
||||
@note.update_attributes(:x => 500)
|
||||
@post.reload
|
||||
assert_equal(@post.last_noted_at.to_i, @note.updated_at.to_i)
|
||||
end
|
||||
@@ -105,7 +111,7 @@ class NoteTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "fail" do
|
||||
@note.update_attributes(:x => 1000)
|
||||
@note.update_attributes(:x => 500)
|
||||
assert_equal(["Post is note locked"], @note.errors.full_messages)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user