Sha256: bdad5bb8cdf306e97958835323ad7415c48aa951136a4970877c0b1bbdd6b161

Contents?: true

Size: 820 Bytes

Versions: 6

Compression:

Stored size: 820 Bytes

Contents

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

class GalleryTest < ActiveSupport::TestCase
  
  def test_fixtures_validity
    SofaGallery::Gallery.all.each do |gallery|
      assert gallery.valid?, gallery.errors.full_messages.to_s
    end
  end
  
  def test_validations
    gallery = SofaGallery::Gallery.new
    assert gallery.invalid?
    assert_has_errors_on gallery, [:title, :slug]
  end
  
  def test_creation
    assert_difference 'SofaGallery::Gallery.count' do
      SofaGallery::Gallery.create!(
        :title  => 'Test Gallery',
        :slug   => 'test-gallery'
      )
    end
  end
  
  def test_destoy
    gallery = sofa_gallery_galleries(:default)
    assert_difference ['SofaGallery::Gallery.count', 'SofaGallery::Photo.count'], -1 do
      gallery.destroy
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

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