Skip to content
Browse files

Port over the job disabling scenario

  • Loading branch information...
1 parent 217d694 commit 76a13cab7d9239bec6ca4647fb95df86ef304582 @rtyler committed Jul 31, 2012
Showing with 30 additions and 4 deletions.
  1. +5 −0 features/freestyle_build.feature
  2. +21 −4 features/step_definitions/freestyle_steps.rb
  3. +4 −0 lib/job.rb
View
5 features/freestyle_build.feature
@@ -54,5 +54,10 @@ Feature: Configure/build freestyle jobs
When I run the job
Then the build should succeed
+ Scenario: Disable a job
+ Given a job
+ When I disable the job
+ Then it should be disabled
+ And it should have an "Enable" button on the job page
# vim: tabstop=2 expandtab shiftwidth=2
View
25 features/step_definitions/freestyle_steps.rb
@@ -90,13 +90,30 @@
end
When /^I add an Ant build step for:$/ do |ant_xml|
- @job.add_script_step("cat > build.xml << EOF
-#{ant_xml}
+ @job.configure do
+ @job.add_script_step("cat > build.xml <<EOF
+ #{ant_xml}
EOF")
- @job.add_ant_step('hello', 'build.xml')
- @job.save
+ @job.add_ant_step('hello', 'build.xml')
+ end
end
Then /^the build should succeed$/ do
@job.last_build.succeeded?.should be true
end
+
+When /^I disable the job$/ do
+ @job.configure do
+ @job.disable
+ end
+end
+
+Then /^it should be disabled$/ do
+ page.should_not have_content 'Build Now'
+end
+
+Then /^it should have an "(.*?)" button on the job page$/ do |button|
+ @job.open
+ page.should have_xpath("//button[text()='Enable']")
+end
+
View
4 lib/job.rb
@@ -91,6 +91,10 @@ def label_expression=(expression)
find(:xpath, "//input[@name='_.assignedLabelString']").set(expression)
end
+ def disable
+ check 'disable'
+ end
+
def self.create_freestyle(base_url, name)
visit("#{@base_url}/newJob")

0 comments on commit 76a13ca

Please sign in to comment.
Something went wrong with that request. Please try again.