Permalink
Browse files

WIP

  • Loading branch information...
Jared Grippe authored and deadlyicon committed Nov 23, 2011
1 parent 4266350 commit 3f5cd823dfd2880d27eb19d37076b8ccd59ea739
Showing with 31 additions and 5 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 features/step_definitions/sleep_steps.rb
  3. +25 −0 lib/example_hobson_project.rb
  4. +1 −1 spec/a_spec.rb
  5. +1 −1 spec/b_spec.rb
  6. +1 −1 spec/c_spec.rb
  7. +1 −1 spec/d_spec.rb
View
@@ -0,0 +1 @@
+log/*
@@ -1,3 +1,3 @@
Then /^this scenario should take (\d+) seconds? to run$/ do |n|
- sleep n.to_f
+ ExampleHobsonProject.sleep_and_log_for n
end
@@ -0,0 +1,25 @@
+require 'logger'
+
+module ExampleHobsonProject
+
+ extend self
+
+ def root
+ @root ||= Pathname.new File.expand_path('../..', __FILE__)
+ end
+
+ def logger
+ @logger ||= begin
+ root.join('log').mkpath
+ Logger.new(root.join('log/app.log'))
+ end
+ end
+
+ def sleep_and_log_for n
+ n.to_i.times do
+ logger.info "sleeping for 1 second"
+ sleep 1
+ end
+ end
+
+end
View
@@ -3,7 +3,7 @@
describe 'a' do
it "should take 1 second to run this spec" do
- sleep 1
+ ExampleHobsonProject.sleep_and_log_for 1
end
end
View
@@ -3,7 +3,7 @@
describe 'b' do
it "should take 2 seconds to run this spec" do
- sleep 2
+ ExampleHobsonProject.sleep_and_log_for 2
end
end
View
@@ -3,7 +3,7 @@
describe 'c' do
it "should take 3 seconds to run this spec" do
- sleep 3
+ ExampleHobsonProject.sleep_and_log_for 3
end
end
View
@@ -3,7 +3,7 @@
describe 'd' do
it "should take 4 seconds to run this spec" do
- sleep 4
+ ExampleHobsonProject.sleep_and_log_for 4
end
end

0 comments on commit 3f5cd82

Please sign in to comment.