blame_controller_spec.rb 749 Bytes
Newer Older
Stan Hu's avatar
Stan Hu committed
1 2 3
require 'spec_helper'

describe Projects::BlameController do
4
  let(:project) { create(:project, :repository) }
Stan Hu's avatar
Stan Hu committed
5 6 7 8 9
  let(:user)    { create(:user) }

  before do
    sign_in(user)

10
    project.add_maintainer(user)
Stan Hu's avatar
Stan Hu committed
11 12 13 14 15 16 17 18
    controller.instance_variable_set(:@project, project)
  end

  describe "GET show" do
    render_views

    before do
      get(:show,
19 20
          namespace_id: project.namespace,
          project_id: project,
Stan Hu's avatar
Stan Hu committed
21 22 23 24 25 26 27
          id: id)
    end

    context "valid file" do
      let(:id) { 'master/files/ruby/popen.rb' }
      it { is_expected.to respond_with(:success) }
    end
28 29 30

    context "invalid file" do
      let(:id) { 'master/files/ruby/missing_file.rb'}
31
      it { expect(response).to have_gitlab_http_status(404) }
32
    end
Stan Hu's avatar
Stan Hu committed
33 34
  end
end