Sha256: 8051b1eb6a7d6d4508d1c5caf056aca2bf1df5971511002730bf50bbf995d7ba

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 Bytes

Contents

require File.expand_path('../test_helper', File.dirname(__FILE__))

class PhotoTest < ActiveSupport::TestCase
  
  def test_fixtures_validity
    Gallery::Photo.all.each do |photo|
      assert photo.valid?, photo.errors.full_messages.to_s
    end
  end
  
  def test_validations
    photo = Gallery::Photo.new
    assert photo.invalid?
    assert_has_errors_on photo, {
      :gallery_id       => ["can't be blank"],
      :image_file_name  => ["There was no file uploaded!"]
    }
  end
  
  def test_creation
    gallery = gallery_galleries(:default)
    assert_difference 'Gallery::Photo.count' do
      Gallery::Photo.create!(
        :gallery  => gallery,
        :title    => 'Test Photo',
        :image    => fixture_file_upload('/files/default.jpg', 'image/jpeg')
      )
    end
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comfy_gallery-0.1.3 test/unit/photo_test.rb
comfy_gallery-0.1.2 test/unit/photo_test.rb
comfy_gallery-0.1.1 test/unit/photo_test.rb