summaryrefslogtreecommitdiff
path: root/spec/ci/controllers/commits_controller_spec.rb
blob: f32d6f8c126e88ac31be25fe5ce207f022c8f587 (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
require "spec_helper"

describe CommitsController do
  before do
    @project = FactoryGirl.create :project
  end

  describe "GET /status" do
    it "returns status of commit" do
      commit = FactoryGirl.create :commit, project: @project
      get :status, id: commit.sha, ref_id: commit.ref, project_id: @project.id

      expect(response).to be_success
      expect(response.code).to eq('200')
      JSON.parse(response.body)["status"] == "pending"
    end

    it "returns not_found status" do
      commit = FactoryGirl.create :commit, project: @project
      get :status, id: commit.sha, ref_id: "deploy", project_id: @project.id

      expect(response).to be_success
      expect(response.code).to eq('200')
      JSON.parse(response.body)["status"] == "not_found"
    end
  end
end