Permalink
Browse files

Little ajusts

  • Loading branch information...
1 parent b66151b commit e08ac0aa558f173d204816aabdd67d41a5651c6e @hugomaiavieira hugomaiavieira committed Jan 15, 2012
Showing with 15 additions and 8 deletions.
  1. +1 −1 app/models/project.rb
  2. +14 −7 spec/models/project_spec.rb
View
@@ -46,7 +46,7 @@ def contributors_for_token_input
end
def tasks_by_position position
- tasks.select {|item| item.position == position }
+ tasks.select { |item| item.position.to_s == position.to_s }
end
def clean_up_done_tasks
@@ -47,13 +47,20 @@
end
end
- it 'should return all contributors, including owner and other contributors' do
- hugo = Factory.create :contributor
- rodrigo = Factory.create :contributor
- dudu = Factory.create :contributor
- project = Factory.create :project, :owner => hugo, :contributors => [rodrigo]
- project.all_contributors.should include(hugo, rodrigo)
- project.all_contributors.should_not include(dudu)
+ context 'should return all contributors when' do
+ it 'has only the owner' do
+ hugo = Factory.create :contributor
+ project = Factory.create :project, :owner => hugo
+ project.all_contributors.should include(hugo)
+ end
+
+ it 'has the owner and other contributor' do
+ hugo = Factory.create :contributor
+ rodrigo = Factory.create :contributor
+ project = Factory.create :project, :owner => hugo, :contributors => [rodrigo]
+ project.all_contributors.should include(hugo, rodrigo)
+ project.all_contributors.should have(2).contributors
+ end
end
it 'should return a json with its contributors id and name' do

0 comments on commit e08ac0a

Please sign in to comment.