summaryrefslogtreecommitdiff
path: root/spec/features/jobs_spec.rb
blob: 6945a8f2ec427886bd889be41c3b8f575cd35d10 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
require 'spec_helper'

describe "Jobs" do
  before do
    login_as :user
    @project = FactoryGirl.create :project
  end

  describe "GET /projects/:id/jobs" do
    before do
      visit project_jobs_path(@project)
    end

    it { page.should have_content @project.name }
    it { page.should have_link 'Add a job' }

    describe 'change job script' do
      it "updates job" do
        fill_in 'Script', with: 'pwd'
        fill_in 'Name', with: 'New Job'
        fill_in 'Tags', with: 'Tags'
        check "Builds commits"
        check "Build tags"

        click_button 'Save changes'

        page.should have_content 'successfully updated'

        find_field('Script').value.should eq 'pwd'
        find_field('Name').value.should eq 'New Job'
        find_field('Tags').value.should eq 'Tags'
        find_field('Builds commits').should be_checked
        find_field('Build tags').should be_checked
      end
    end
  end

  describe "GET /projects/:id/jobs/deploy_jobs" do
    before do
      visit deploy_jobs_project_jobs_path(@project)
    end

    it { page.should have_content @project.name } 
    it { page.should have_link 'Add a job' }
    it { page.should have_content 'Deploy jobs are scripts you want CI to run on succeeding all parallel builds' }

    describe 'change job script', js: true do
      it "updates deploy job" do
        click_on "Add a job"

        fill_in 'Script', with: 'pwd'
        fill_in 'Name', with: 'New Job'
        fill_in 'Tags', with: 'Tags'
        fill_in 'Refs', with: 'master'

        click_button 'Save changes'

        page.should have_content 'successfully updated'

        find_field('Script').value.should eq 'pwd'
        find_field('Name').value.should eq 'New Job'
        find_field('Tags').value.should eq 'Tags'
        find_field('Refs').value.should eq 'master'
      end
    end
  end
end