Commit 28df3e683be6389e958dc93fd0c10b5a8af7323b
1 parent
3586d72e
Exists in
colab
and in
4 other branches
Method repositories from the Project model covered with unit test
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
app/models/project.rb
... | ... | @@ -7,7 +7,7 @@ class Project < KalibroEntities::Entities::Project |
7 | 7 | validates :name, presence: true, kalibro_uniqueness: true |
8 | 8 | |
9 | 9 | def repositories |
10 | - KalibroEntities::Entities::Repository.repositories_of(self.id) | |
10 | + Repository.repositories_of(self.id) | |
11 | 11 | end |
12 | 12 | |
13 | 13 | def self.latest(count = 1) | ... | ... |
spec/models/project_spec.rb
... | ... | @@ -58,6 +58,17 @@ describe Project do |
58 | 58 | end |
59 | 59 | end |
60 | 60 | end |
61 | + | |
62 | + describe 'repositories' do | |
63 | + subject { FactoryGirl.build(:project) } | |
64 | + let(:repository) { FactoryGirl.build(:repository) } | |
65 | + | |
66 | + it 'should call repositories_of on the Repository model' do | |
67 | + Repository.expects(:repositories_of).with(subject.id).returns([repository]) | |
68 | + | |
69 | + subject.repositories.should include(repository) | |
70 | + end | |
71 | + end | |
61 | 72 | end |
62 | 73 | |
63 | 74 | describe 'validations' do | ... | ... |