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

keys_spec.rb « requests « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 316115f923452a30cd472fc261d4895e5a3ad0ad (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'spec_helper'

describe "Issues" do
  before do 
    login_as :user
  end

  describe "GET /keys" do
    before do 
      @key = Factory :key, :user => @user
      visit keys_path
    end

    subject { page }

    it { should have_content(@key.title) }

    describe "Destroy" do 
      it "should remove entry" do 
        expect {
          click_link "destroy_key_#{@key.id}"
        }.to change { @user.keys.count }.by(-1)
      end
    end
  end

  describe "New key", :js => true do 
    before do 
      visit keys_path
      click_link "Add new"
    end

    it "should open new key popup" do 
      page.should have_content("Add new public key")
    end

    describe "fill in" do 
      before do
        fill_in "key_title", :with => "laptop"
        fill_in "key_key", :with => "publickey234="
      end

      it { expect { click_button "Save" }.to change {Key.count}.by(1) }

      it "should add new key to table" do 
        click_button "Save"

        page.should_not have_content("Add new public key")
        page.should have_content "laptop"
        page.should have_content "publickey234="
      end
    end
  end
end