Sha256: 73636c40fc5789bdf8032c0a7d72b1f19367d27588e319a66cc2ba80de16bbe5

Contents?: true

Size: 762 Bytes

Versions: 5

Compression:

Stored size: 762 Bytes

Contents

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

class PhotoTest < ActiveSupport::TestCase
  
  def test_fixtures_validity
    SofaGallery::Photo.all.each do |photo|
      assert photo.valid?, photo.errors.full_messages.to_s
    end
  end
  
  def test_validations
    photo = SofaGallery::Photo.new
    assert photo.invalid?
    assert_has_errors_on photo, :image_file_name
  end
  
  def test_creation
    gallery = sofa_gallery_galleries(:default)
    assert_difference 'SofaGallery::Photo.count' do
      SofaGallery::Photo.create!(
        :gallery  => gallery,
        :title    => 'Test Photo',
        :slug     => 'test-photo',
        :image    => fixture_file_upload('/files/default.jpg', 'image/jpeg')
      )
    end
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sofa_gallery-0.0.5 test/unit/photo_test.rb
sofa_gallery-0.0.4 test/unit/photo_test.rb
sofa_gallery-0.0.3 test/unit/photo_test.rb
sofa_gallery-0.0.2 test/unit/photo_test.rb
sofa_gallery-0.0.1 test/unit/photo_test.rb