Added associations to Rate. #1917

This commit is contained in:
Eric Davis
2009-01-16 14:00:11 -08:00
parent a3c12fed19
commit 3f39bdaa6b
2 changed files with 17 additions and 0 deletions
+3
View File
@@ -1,2 +1,5 @@
class Rate < ActiveRecord::Base
belongs_to :project
belongs_to :user
has_many :time_entries
end
+14
View File
@@ -1,2 +1,16 @@
require File.dirname(__FILE__) + '/../spec_helper'
describe Rate, 'associations' do
it 'should have many time entries' do
Rate.should have_association(:time_entries, :has_many)
end
it 'should belong to a single user' do
Rate.should have_association(:user, :belongs_to)
end
it 'should belong to a single project' do
Rate.should have_association(:project, :belongs_to)
end
end