require File.dirname(__FILE__) + '/../test_helper'

class DiveTest < Test::Unit::TestCase
  fixtures :dives

  # Replace this with your real tests.
  def test_truth
    assert true
  end
  
  def test_invalid_with_empty_attributes
    dive = Dive.new
    assert !dive.valid?
    assert dive.errors.invalid?(:depth)
    assert dive.errors.invalid?(:bottom_time)
    assert dive.errors.invalid?(:location)
  end
  
  def test_non_numbers_entered
    @dive.bottom_time = "one minute"
    @dive.depth = "one foot"
    assert !@dive.valid?
    assert @dive.errors.invalid?(:bottom_time)
    assert @dive.errors.invalid?(:depth)
  end
  
  def test_negative_depth
    @dive.depth = -1
    assert !@dive.valid?
    assert @dive.errors.invalid?(:depth)
  end
  
  
  def setup
    @dive = Dive.new(:depth => 20, :bottom_time => 40, :location =>"tormentos, cozumel, mexico")
  end
  
end
