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
| @@ -2,7 +2,7 @@ require File.join(Rails.root, "app/models/commit") | @@ -2,7 +2,7 @@ require File.join(Rails.root, "app/models/commit") | ||
| 2 | 2 | ||
| 3 | class MergeRequest < ActiveRecord::Base | 3 | class MergeRequest < ActiveRecord::Base |
| 4 | include IssueCommonality | 4 | include IssueCommonality |
| 5 | - include Upvote | 5 | + include Votes |
| 6 | 6 | ||
| 7 | BROKEN_DIFF = "--broken-diff" | 7 | BROKEN_DIFF = "--broken-diff" |
| 8 | 8 |
app/roles/upvote.rb
spec/models/issue_spec.rb
| @@ -12,7 +12,7 @@ describe Issue do | @@ -12,7 +12,7 @@ describe Issue do | ||
| 12 | 12 | ||
| 13 | describe 'modules' do | 13 | describe 'modules' do |
| 14 | it { should include_module(IssueCommonality) } | 14 | it { should include_module(IssueCommonality) } |
| 15 | - it { should include_module(Upvote) } | 15 | + it { should include_module(Votes) } |
| 16 | end | 16 | end |
| 17 | 17 | ||
| 18 | subject { Factory.create(:issue) } | 18 | subject { Factory.create(:issue) } |
spec/models/merge_request_spec.rb
| @@ -8,6 +8,6 @@ describe MergeRequest do | @@ -8,6 +8,6 @@ describe MergeRequest do | ||
| 8 | 8 | ||
| 9 | describe 'modules' do | 9 | describe 'modules' do |
| 10 | it { should include_module(IssueCommonality) } | 10 | it { should include_module(IssueCommonality) } |
| 11 | - it { should include_module(Upvote) } | 11 | + it { should include_module(Votes) } |
| 12 | end | 12 | end |
| 13 | end | 13 | end |
spec/roles/upvote_spec.rb
| @@ -1,27 +0,0 @@ | @@ -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 @@ | @@ -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 |