Commit 28a83058 by Jon Yurek

Fixed issue with my own tests and the matchers.

parent 832298b6
...@@ -5,7 +5,7 @@ class HaveAttachedFileMatcherTest < Test::Unit::TestCase ...@@ -5,7 +5,7 @@ class HaveAttachedFileMatcherTest < Test::Unit::TestCase
setup do setup do
@dummy_class = reset_class "Dummy" @dummy_class = reset_class "Dummy"
reset_table "dummies" reset_table "dummies"
@matcher = have_attached_file(:avatar) @matcher = self.class.have_attached_file(:avatar)
end end
should "reject a class with no attachment" do should "reject a class with no attachment" do
......
...@@ -8,7 +8,7 @@ class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase ...@@ -8,7 +8,7 @@ class ValidateAttachmentContentTypeMatcherTest < Test::Unit::TestCase
end end
@dummy_class = reset_class "Dummy" @dummy_class = reset_class "Dummy"
@dummy_class.has_attached_file :avatar @dummy_class.has_attached_file :avatar
@matcher = validate_attachment_content_type(:avatar). @matcher = self.class.validate_attachment_content_type(:avatar).
allowing(%w(image/png image/jpeg)). allowing(%w(image/png image/jpeg)).
rejecting(%w(audio/mp3 application/octet-stream)) rejecting(%w(audio/mp3 application/octet-stream))
end end
......
...@@ -6,7 +6,7 @@ class ValidateAttachmentPresenceMatcherTest < Test::Unit::TestCase ...@@ -6,7 +6,7 @@ class ValidateAttachmentPresenceMatcherTest < Test::Unit::TestCase
reset_table("dummies"){|d| d.string :avatar_file_name } reset_table("dummies"){|d| d.string :avatar_file_name }
@dummy_class = reset_class "Dummy" @dummy_class = reset_class "Dummy"
@dummy_class.has_attached_file :avatar @dummy_class.has_attached_file :avatar
@matcher = validate_attachment_presence(:avatar) @matcher = self.class.validate_attachment_presence(:avatar)
end end
should "reject a class with no validation" do should "reject a class with no validation" do
......
...@@ -11,7 +11,7 @@ class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase ...@@ -11,7 +11,7 @@ class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase
end end
context "of limited size" do context "of limited size" do
setup{ @matcher = validate_attachment_size(:avatar).in(256..1024) } setup{ @matcher = self.class.validate_attachment_size(:avatar).in(256..1024) }
should "reject a class with no validation" do should "reject a class with no validation" do
assert_rejects @matcher, @dummy_class assert_rejects @matcher, @dummy_class
...@@ -34,7 +34,7 @@ class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase ...@@ -34,7 +34,7 @@ class ValidateAttachmentSizeMatcherTest < Test::Unit::TestCase
end end
context "validates_attachment_size with infinite range" do context "validates_attachment_size with infinite range" do
setup{ @matcher = validate_attachment_size(:avatar) } setup{ @matcher = self.class.validate_attachment_size(:avatar) }
should "accept a class with an upper limit" do should "accept a class with an upper limit" do
@dummy_class.validates_attachment_size :avatar, :less_than => 1 @dummy_class.validates_attachment_size :avatar, :less_than => 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment