diff options
| author | Robert Speicher <rspeicher@gmail.com> | 2012-08-28 07:01:27 -0400 |
|---|---|---|
| committer | Robert Speicher <rspeicher@gmail.com> | 2012-08-28 21:22:49 -0400 |
| commit | 77d06454ededc3beef09db709829ccb687ccc045 (patch) | |
| tree | d051a03c8753fb8947fe94638120ede631b8041c /spec/models/note_spec.rb | |
| parent | 0bc909405852135d7f98440193830eba664ea122 (diff) | |
| download | gitlab-ce-77d06454ededc3beef09db709829ccb687ccc045.tar.gz | |
Simple model spec changes made possible by new factories
Diffstat (limited to 'spec/models/note_spec.rb')
| -rw-r--r-- | spec/models/note_spec.rb | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb index c97b23cb4fa..89e50479762 100644 --- a/spec/models/note_spec.rb +++ b/spec/models/note_spec.rb @@ -1,9 +1,6 @@ require 'spec_helper' describe Note do - let(:project) { Factory :project } - let!(:commit) { project.commit } - describe "Associations" do it { should belong_to(:project) } end @@ -13,8 +10,6 @@ describe Note do it { should validate_presence_of(:project) } end - it { Factory.create(:note, - project: project).should be_valid } describe "Scopes" do it "should have a today named scope that returns ..." do Note.today.where_values.should == ["created_at >= '#{Date.today}'"] @@ -25,26 +20,27 @@ describe Note do let(:project) { Factory(:project) } it "recognizes a neutral note" do - note = Factory(:note, project: project, note: "This is not a +1 note") + note = Factory(:note, note: "This is not a +1 note") note.should_not be_upvote end it "recognizes a +1 note" do - note = Factory(:note, project: project, note: "+1 for this") + note = Factory(:note, note: "+1 for this") note.should be_upvote end it "recognizes a -1 note as no vote" do - note = Factory(:note, project: project, note: "-1 for this") + note = Factory(:note, note: "-1 for this") note.should_not be_upvote end end - describe "Commit notes" do + let(:project) { create(:project) } + let(:commit) { project.commit } + describe "Commit notes" do before do @note = Factory :note, - project: project, noteable_id: commit.id, noteable_type: "Commit" end @@ -58,7 +54,6 @@ describe Note do describe "Pre-line commit notes" do before do @note = Factory :note, - project: project, noteable_id: commit.id, noteable_type: "Commit", line_code: "0_16_1" @@ -91,8 +86,8 @@ describe Note do describe :authorization do before do - @p1 = project - @p2 = Factory :project, code: "alien", path: "gitlabhq_1" + @p1 = create(:project) + @p2 = Factory :project @u1 = Factory :user @u2 = Factory :user @u3 = Factory :user |
