Commit a2a0060034171e22962129d53cc74fb7bde54476
1 parent
06c1a8a9
Exists in
master
and in
4 other branches
Rename Upvote role to Votes
Showing
8 changed files
with
37 additions
and
37 deletions
Show diff stats
app/models/issue.rb
app/models/merge_request.rb
app/roles/upvote.rb
spec/models/issue_spec.rb
spec/models/merge_request_spec.rb
spec/roles/upvote_spec.rb
| ... | ... | @@ -1,27 +0,0 @@ |
| 1 | -require 'spec_helper' | |
| 2 | - | |
| 3 | -describe Issue, "Upvote" do | |
| 4 | - let(:issue) { create(:issue) } | |
| 5 | - | |
| 6 | - it "with no notes has a 0/0 score" do | |
| 7 | - issue.upvotes.should == 0 | |
| 8 | - end | |
| 9 | - | |
| 10 | - it "should recognize non-+1 notes" do | |
| 11 | - issue.notes << create(:note, note: "No +1 here") | |
| 12 | - issue.should have(1).note | |
| 13 | - issue.notes.first.upvote?.should be_false | |
| 14 | - issue.upvotes.should == 0 | |
| 15 | - end | |
| 16 | - | |
| 17 | - it "should recognize a single +1 note" do | |
| 18 | - issue.notes << create(:note, note: "+1 This is awesome") | |
| 19 | - issue.upvotes.should == 1 | |
| 20 | - end | |
| 21 | - | |
| 22 | - it "should recognize multiple +1 notes" do | |
| 23 | - issue.notes << create(:note, note: "+1 This is awesome") | |
| 24 | - issue.notes << create(:note, note: "+1 I want this") | |
| 25 | - issue.upvotes.should == 2 | |
| 26 | - end | |
| 27 | -end |
| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | +require 'spec_helper' | |
| 2 | + | |
| 3 | +describe Issue, "Upvote" do | |
| 4 | + let(:issue) { create(:issue) } | |
| 5 | + | |
| 6 | + it "with no notes has a 0/0 score" do | |
| 7 | + issue.upvotes.should == 0 | |
| 8 | + end | |
| 9 | + | |
| 10 | + it "should recognize non-+1 notes" do | |
| 11 | + issue.notes << create(:note, note: "No +1 here") | |
| 12 | + issue.should have(1).note | |
| 13 | + issue.notes.first.upvote?.should be_false | |
| 14 | + issue.upvotes.should == 0 | |
| 15 | + end | |
| 16 | + | |
| 17 | + it "should recognize a single +1 note" do | |
| 18 | + issue.notes << create(:note, note: "+1 This is awesome") | |
| 19 | + issue.upvotes.should == 1 | |
| 20 | + end | |
| 21 | + | |
| 22 | + it "should recognize multiple +1 notes" do | |
| 23 | + issue.notes << create(:note, note: "+1 This is awesome") | |
| 24 | + issue.notes << create(:note, note: "+1 I want this") | |
| 25 | + issue.upvotes.should == 2 | |
| 26 | + end | |
| 27 | +end | ... | ... |