Welcome to mirror list, hosted at ThFree Co, Russian Federation.

commits_spec.rb « api « requests « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3af5ec21c432e594e91a7912932c3ea0fbf39956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'spec_helper'

describe Gitlab::API do
  include ApiHelpers

  let(:user) { Factory :user }
  let!(:project) { Factory :project, owner: user }

  describe "GET /projects/:id/commits" do
    context "authorized user" do
      before { project.add_access(user, :read) }

      it "should return project commits" do
        get api("/projects/#{project.code}/commits", user)
        response.status.should == 200

        json_response.should be_an Array
        json_response.first['id'].should == project.commit.id
      end
    end

    context "unauthorized user" do
      it "should return project commits" do
        get api("/projects/#{project.code}/commits")
        response.status.should == 401
      end
    end
  end
end