34 lines
767 B
Ruby
34 lines
767 B
Ruby
require File.dirname(__FILE__) + '/../test_helper'
|
|
|
|
class DeliverableTest < ActiveSupport::TestCase
|
|
should_belong_to :contract
|
|
should_belong_to :manager
|
|
|
|
should_validate_presence_of :title
|
|
should_validate_presence_of :type
|
|
should_validate_presence_of :manager
|
|
|
|
context "#total=" do
|
|
should "strip dollar signs when writing" do
|
|
d = Deliverable.new
|
|
d.total = '$100.00'
|
|
|
|
assert_equal 100.00, d.total.to_f
|
|
end
|
|
|
|
should "strip commas when writing" do
|
|
d = Deliverable.new
|
|
d.total = '20,100.00'
|
|
|
|
assert_equal 20100.00, d.total.to_f
|
|
end
|
|
|
|
should "strip spaces when writing" do
|
|
d = Deliverable.new
|
|
d.total = '20 100.00'
|
|
|
|
assert_equal 20100.00, d.total.to_f
|
|
end
|
|
end
|
|
end
|