Sha256: fd951052db86260eea454d2b804534f3ce66e152dcf8d93b137145f000c88696

Contents?: true

Size: 806 Bytes

Versions: 3

Compression:

Stored size: 806 Bytes

Contents

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

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