Commit 5d08a5a5 authored by Robert Speicher's avatar Robert Speicher

Note's voting specs don't need to persist to the database

parent 6fdc51f8
...@@ -34,48 +34,46 @@ describe Note do ...@@ -34,48 +34,46 @@ describe Note do
it { is_expected.to validate_presence_of(:project) } it { is_expected.to validate_presence_of(:project) }
end end
describe "Voting score" do describe 'voting score' do
let(:project) { create(:project) } it 'recognizes a neutral note' do
note = build(:votable_note, note: 'This is not a +1 note')
it "recognizes a neutral note" do
note = create(:votable_note, note: "This is not a +1 note")
expect(note).not_to be_upvote expect(note).not_to be_upvote
expect(note).not_to be_downvote expect(note).not_to be_downvote
end end
it "recognizes a neutral emoji note" do it 'recognizes a neutral emoji note' do
note = build(:votable_note, note: "I would :+1: this, but I don't want to") note = build(:votable_note, note: "I would :+1: this, but I don't want to")
expect(note).not_to be_upvote expect(note).not_to be_upvote
expect(note).not_to be_downvote expect(note).not_to be_downvote
end end
it "recognizes a +1 note" do it 'recognizes a +1 note' do
note = create(:votable_note, note: "+1 for this") note = build(:votable_note, note: '+1 for this')
expect(note).to be_upvote expect(note).to be_upvote
end end
it "recognizes a +1 emoji as a vote" do it 'recognizes a +1 emoji as a vote' do
note = build(:votable_note, note: ":+1: for this") note = build(:votable_note, note: ':+1: for this')
expect(note).to be_upvote expect(note).to be_upvote
end end
it "recognizes a thumbsup emoji as a vote" do it 'recognizes a thumbsup emoji as a vote' do
note = build(:votable_note, note: ":thumbsup: for this") note = build(:votable_note, note: ':thumbsup: for this')
expect(note).to be_upvote expect(note).to be_upvote
end end
it "recognizes a -1 note" do it 'recognizes a -1 note' do
note = create(:votable_note, note: "-1 for this") note = build(:votable_note, note: '-1 for this')
expect(note).to be_downvote expect(note).to be_downvote
end end
it "recognizes a -1 emoji as a vote" do it 'recognizes a -1 emoji as a vote' do
note = build(:votable_note, note: ":-1: for this") note = build(:votable_note, note: ':-1: for this')
expect(note).to be_downvote expect(note).to be_downvote
end end
it "recognizes a thumbsdown emoji as a vote" do it 'recognizes a thumbsdown emoji as a vote' do
note = build(:votable_note, note: ":thumbsdown: for this") note = build(:votable_note, note: ':thumbsdown: for this')
expect(note).to be_downvote expect(note).to be_downvote
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment