Skip to content

Commit

Permalink
Merge pull request openfarmcc#334 from rickcarlino/master
Browse files Browse the repository at this point in the history
Get test coverage back up.
  • Loading branch information
simonv3 committed Dec 5, 2014
2 parents 929c54d + be5b776 commit 2e59942
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
21 changes: 11 additions & 10 deletions app/models/guide.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,19 @@ def compatibility_score
end

def compatibility_label
''
# TODO:
score = compatibility_score
# score = compatibility_score

if score.nil?
return ''
elsif score > 75
return 'high'
elsif score > 50
return 'medium'
else
return 'low'
end
# if score.nil?
# return ''
# elsif score > 75
# return 'high'
# elsif score > 50
# return 'medium'
# else
# return 'low'
# end
end

slug :name
Expand Down
16 changes: 16 additions & 0 deletions spec/models/guide_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,20 @@
expect(guide.owned_by?(nil)).to eq(false)
expect(guide.owned_by?(other_user)).to eq(false)
end

it 'has not implemented a real compatibility label' do
guide = FactoryGirl.build(:guide)

guide.stub(:compatibility_score).and_return 80
expect(guide.compatibility_label).to eq('')

guide.stub(:compatibility_score).and_return 60
expect(guide.compatibility_label).to eq('')

guide.stub(:compatibility_score).and_return 20
expect(guide.compatibility_label).to eq('')

guide.stub(:compatibility_score).and_return nil
expect(guide.compatibility_label).to eq('')
end
end

0 comments on commit 2e59942

Please sign in to comment.