test/unit/slide_test.rb in comfy_carousel-0.0.1 vs test/unit/slide_test.rb in comfy_carousel-0.0.2
- old
+ new
@@ -13,17 +13,27 @@
assert slide.invalid?
assert_has_errors_on slide, [:carousel_id, :label]
end
def test_creation
+ carousel = carousel_carousels(:default)
assert_difference 'Carousel::Slide.count' do
- slide = carousel_carousels(:default).slides.create(
+ slide = carousel.slides.create(
:label => 'Test',
:content => 'Test Content',
:url => 'http://google.com',
:file => fixture_file_upload('files/image.jpg', 'image/jpeg')
)
assert_equal 1, slide.position
+ assert_equal carousel, slide.carousel
end
+ end
+
+ def test_is_image?
+ slide = carousel_slides(:default)
+ assert slide.is_image?
+
+ slide.update_attribute(:file_content_type, 'application/pdf')
+ assert !slide.is_image?
end
end
\ No newline at end of file