# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one:
id: 1
+ from_user_id: users(:normal_user).id
+ title: test message 1
+ body: some body text
+ sent_on: "2008-05-01 12:34:56"
+ message_read: false
+ to_user_id: users(:second_user).id
+
two:
id: 2
home_lat: 1
home_lon: 1
home_zoom: 3
+
+second_user:
+ email:test@example.com
+ id: 2
+ active: 1
+ pass_crypt: <%= Digest::MD5.hexdigest('test') %>
+ creation_time: "2008-05-01 01:23:45"
+ display_name: test2
+ data_public: 1
+ description: some test description
+ home_lat: 12
+ home_lon: 12
+ home_zoom: 12
class MessageTest < Test::Unit::TestCase
fixtures :messages
- # Replace this with your real tests.
- def test_truth
- assert true
+ def test_check_empty_message_fails
+ message = Message.new
+ assert !message.valid?
+ assert message.errors.invalid?(:title)
+ assert message.errors.invalid?(:body)
+ assert message.errors.invalid?(:sent_on)
+ assert true, message.message_read
end
+
end
class UserTest < Test::Unit::TestCase
fixtures :users
-
- # Replace this with your real tests.
- def test_truth
- assert true
- end
def test_invalid_with_empty_attributes
user = User.new