Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- test "that rate with same from- and to-rate is invalid" do
- rate = ExchangeRate.new
- rate.name = "From To Same"
- euro = Currency.new
- rate.from_currency = euro
- rate.to_currency = euro
- assert rate.from_currency == rate.to_currency
- assert !rate.valid?
- end
- Message:
- 1) Failure:
- test_that_rate_with_same_from-_and_to-rate_is_invalid(ExchangeRateTest) [/test/unit/exchange_rate_test.rb:25]:
- <false> is not true.
- exchange_rate.rb:
- class ExchangeRate < ActiveRecord::Base
- validates_presence_of :name, :from_currency, :to_currency
- validates_difference_of :from_currency, :to_currency
- has_many :quotes, :as => :object_with_quotes
- has_one :latest_quote, :as => :object_with_quotes, :class_name => 'Quote',
- :order => "datetime DESC", :readonly => true
- belongs_to :from_currency, :class_name => "Currency"
- belongs_to :to_currency, :class_name => "Currency"
- end
Add Comment
Please, Sign In to add comment