Added associations to Rate. #1917
This commit is contained in:
1 parent
a3c12fed19
commit
3f39bdaa6b
2 files changed
+17
No files matched your search
@@ -1,2 +1,5 @@
|
|||||||
class Rate < ActiveRecord::Base
|
class Rate < ActiveRecord::Base
|
||||||
|
belongs_to :project
|
||||||
|
belongs_to :user
|
||||||
|
has_many :time_entries
|
||||||
end
|
end
|
||||||
@@ -1,2 +1,16 @@
|
|||||||
require File.dirname(__FILE__) + '/../spec_helper'
|
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
|
||||||
Reference in new issue
Block a user