diff --git a/app/models/rate.rb b/app/models/rate.rb index 9cb19ca..5fd7da5 100644 --- a/app/models/rate.rb +++ b/app/models/rate.rb @@ -1,2 +1,5 @@ class Rate < ActiveRecord::Base + belongs_to :project + belongs_to :user + has_many :time_entries end diff --git a/spec/models/rate_spec.rb b/spec/models/rate_spec.rb index de50117..279a1fd 100644 --- a/spec/models/rate_spec.rb +++ b/spec/models/rate_spec.rb @@ -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