diff options
author | Jeroen van Baarsen <jeroenvanbaarsen@gmail.com> | 2015-02-12 19:17:35 +0100 |
---|---|---|
committer | Jeroen van Baarsen <jeroenvanbaarsen@gmail.com> | 2015-02-12 19:17:35 +0100 |
commit | 0c4a70a306b871899bf87ce4673918abfee4d95f (patch) | |
tree | c7a702fb511209ffe0eceba245d1ffea71dce1aa /spec/finders | |
parent | de1c450abd6b367390a1295cac402344f500d41d (diff) | |
download | gitlab-ce-0c4a70a306b871899bf87ce4673918abfee4d95f.tar.gz |
Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/issues_finder_spec.rb | 22 | ||||
-rw-r--r-- | spec/finders/merge_requests_finder_spec.rb | 4 | ||||
-rw-r--r-- | spec/finders/notes_finder_spec.rb | 4 | ||||
-rw-r--r-- | spec/finders/projects_finder_spec.rb | 32 | ||||
-rw-r--r-- | spec/finders/snippets_finder_spec.rb | 40 |
5 files changed, 51 insertions, 51 deletions
diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index 06e247aea61..479fa950387 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -27,40 +27,40 @@ describe IssuesFinder do it 'should filter by all' do params = { scope: "all", state: 'opened' } issues = IssuesFinder.new.execute(user, params) - issues.size.should == 3 + expect(issues.size).to eq(3) end it 'should filter by assignee id' do params = { scope: "all", assignee_id: user.id, state: 'opened' } issues = IssuesFinder.new.execute(user, params) - issues.size.should == 2 + expect(issues.size).to eq(2) end it 'should filter by author id' do params = { scope: "all", author_id: user2.id, state: 'opened' } issues = IssuesFinder.new.execute(user, params) - issues.should == [issue3] + expect(issues).to eq([issue3]) end it 'should filter by milestone id' do params = { scope: "all", milestone_id: milestone.id, state: 'opened' } issues = IssuesFinder.new.execute(user, params) - issues.should == [issue1] + expect(issues).to eq([issue1]) end it 'should be empty for unauthorized user' do params = { scope: "all", state: 'opened' } issues = IssuesFinder.new.execute(nil, params) - issues.size.should be_zero + expect(issues.size).to be_zero end it 'should not include unauthorized issues' do params = { scope: "all", state: 'opened' } issues = IssuesFinder.new.execute(user2, params) - issues.size.should == 2 - issues.should_not include(issue1) - issues.should include(issue2) - issues.should include(issue3) + expect(issues.size).to eq(2) + expect(issues).not_to include(issue1) + expect(issues).to include(issue2) + expect(issues).to include(issue3) end end @@ -68,13 +68,13 @@ describe IssuesFinder do it 'should filter by assignee' do params = { scope: "assigned-to-me", state: 'opened' } issues = IssuesFinder.new.execute(user, params) - issues.size.should == 2 + expect(issues.size).to eq(2) end it 'should filter by project' do params = { scope: "assigned-to-me", state: 'opened', project_id: project1.id } issues = IssuesFinder.new.execute(user, params) - issues.size.should == 1 + expect(issues.size).to eq(1) end end end diff --git a/spec/finders/merge_requests_finder_spec.rb b/spec/finders/merge_requests_finder_spec.rb index 94b4d4c4ff4..8536377a7f0 100644 --- a/spec/finders/merge_requests_finder_spec.rb +++ b/spec/finders/merge_requests_finder_spec.rb @@ -21,13 +21,13 @@ describe MergeRequestsFinder do it 'should filter by scope' do params = { scope: 'authored', state: 'opened' } merge_requests = MergeRequestsFinder.new.execute(user, params) - merge_requests.size.should == 2 + expect(merge_requests.size).to eq(2) end it 'should filter by project' do params = { project_id: project1.id, scope: 'authored', state: 'opened' } merge_requests = MergeRequestsFinder.new.execute(user, params) - merge_requests.size.should == 1 + expect(merge_requests.size).to eq(1) end end end diff --git a/spec/finders/notes_finder_spec.rb b/spec/finders/notes_finder_spec.rb index 4f8a5f909df..c83824b900d 100644 --- a/spec/finders/notes_finder_spec.rb +++ b/spec/finders/notes_finder_spec.rb @@ -21,7 +21,7 @@ describe NotesFinder do it 'should find all notes' do notes = NotesFinder.new.execute(project, user, params) - notes.size.should eq(2) + expect(notes.size).to eq(2) end it 'should raise an exception for an invalid target_type' do @@ -32,7 +32,7 @@ describe NotesFinder do it 'filters out old notes' do note2.update_attribute(:updated_at, 2.hours.ago) notes = NotesFinder.new.execute(project, user, params) - notes.should eq([note1]) + expect(notes).to eq([note1]) end end end diff --git a/spec/finders/projects_finder_spec.rb b/spec/finders/projects_finder_spec.rb index 6e3ae4d615b..2ab71b05968 100644 --- a/spec/finders/projects_finder_spec.rb +++ b/spec/finders/projects_finder_spec.rb @@ -12,19 +12,19 @@ describe ProjectsFinder do context 'non authenticated' do subject { ProjectsFinder.new.execute(nil, group: group) } - it { should include(project1) } - it { should_not include(project2) } - it { should_not include(project3) } - it { should_not include(project4) } + it { is_expected.to include(project1) } + it { is_expected.not_to include(project2) } + it { is_expected.not_to include(project3) } + it { is_expected.not_to include(project4) } end context 'authenticated' do subject { ProjectsFinder.new.execute(user, group: group) } - it { should include(project1) } - it { should include(project2) } - it { should_not include(project3) } - it { should_not include(project4) } + it { is_expected.to include(project1) } + it { is_expected.to include(project2) } + it { is_expected.not_to include(project3) } + it { is_expected.not_to include(project4) } end context 'authenticated, project member' do @@ -32,10 +32,10 @@ describe ProjectsFinder do subject { ProjectsFinder.new.execute(user, group: group) } - it { should include(project1) } - it { should include(project2) } - it { should include(project3) } - it { should_not include(project4) } + it { is_expected.to include(project1) } + it { is_expected.to include(project2) } + it { is_expected.to include(project3) } + it { is_expected.not_to include(project4) } end context 'authenticated, group member' do @@ -43,9 +43,9 @@ describe ProjectsFinder do subject { ProjectsFinder.new.execute(user, group: group) } - it { should include(project1) } - it { should include(project2) } - it { should include(project3) } - it { should include(project4) } + it { is_expected.to include(project1) } + it { is_expected.to include(project2) } + it { is_expected.to include(project3) } + it { is_expected.to include(project4) } end end diff --git a/spec/finders/snippets_finder_spec.rb b/spec/finders/snippets_finder_spec.rb index c645cbc964c..1b4ffc2d717 100644 --- a/spec/finders/snippets_finder_spec.rb +++ b/spec/finders/snippets_finder_spec.rb @@ -18,14 +18,14 @@ describe SnippetsFinder do it "returns all private and internal snippets" do snippets = SnippetsFinder.new.execute(user, filter: :all) - snippets.should include(@snippet2, @snippet3) - snippets.should_not include(@snippet1) + expect(snippets).to include(@snippet2, @snippet3) + expect(snippets).not_to include(@snippet1) end it "returns all public snippets" do snippets = SnippetsFinder.new.execute(nil, filter: :all) - snippets.should include(@snippet3) - snippets.should_not include(@snippet1, @snippet2) + expect(snippets).to include(@snippet3) + expect(snippets).not_to include(@snippet1, @snippet2) end end @@ -38,37 +38,37 @@ describe SnippetsFinder do it "returns all public and internal snippets" do snippets = SnippetsFinder.new.execute(user1, filter: :by_user, user: user) - snippets.should include(@snippet2, @snippet3) - snippets.should_not include(@snippet1) + expect(snippets).to include(@snippet2, @snippet3) + expect(snippets).not_to include(@snippet1) end it "returns internal snippets" do snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user, scope: "are_internal") - snippets.should include(@snippet2) - snippets.should_not include(@snippet1, @snippet3) + expect(snippets).to include(@snippet2) + expect(snippets).not_to include(@snippet1, @snippet3) end it "returns private snippets" do snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user, scope: "are_private") - snippets.should include(@snippet1) - snippets.should_not include(@snippet2, @snippet3) + expect(snippets).to include(@snippet1) + expect(snippets).not_to include(@snippet2, @snippet3) end it "returns public snippets" do snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user, scope: "are_public") - snippets.should include(@snippet3) - snippets.should_not include(@snippet1, @snippet2) + expect(snippets).to include(@snippet3) + expect(snippets).not_to include(@snippet1, @snippet2) end it "returns all snippets" do snippets = SnippetsFinder.new.execute(user, filter: :by_user, user: user) - snippets.should include(@snippet1, @snippet2, @snippet3) + expect(snippets).to include(@snippet1, @snippet2, @snippet3) end it "returns only public snippets if unauthenticated user" do snippets = SnippetsFinder.new.execute(nil, filter: :by_user, user: user) - snippets.should include(@snippet3) - snippets.should_not include(@snippet2, @snippet1) + expect(snippets).to include(@snippet3) + expect(snippets).not_to include(@snippet2, @snippet1) end end @@ -82,20 +82,20 @@ describe SnippetsFinder do it "returns public snippets for unauthorized user" do snippets = SnippetsFinder.new.execute(nil, filter: :by_project, project: project1) - snippets.should include(@snippet3) - snippets.should_not include(@snippet1, @snippet2) + expect(snippets).to include(@snippet3) + expect(snippets).not_to include(@snippet1, @snippet2) end it "returns public and internal snippets for none project members" do snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1) - snippets.should include(@snippet2, @snippet3) - snippets.should_not include(@snippet1) + expect(snippets).to include(@snippet2, @snippet3) + expect(snippets).not_to include(@snippet1) end it "returns all snippets for project members" do project1.team << [user, :developer] snippets = SnippetsFinder.new.execute(user, filter: :by_project, project: project1) - snippets.should include(@snippet1, @snippet2, @snippet3) + expect(snippets).to include(@snippet1, @snippet2, @snippet3) end end end |