Class: Jacuzzi
- Inherits:
-
Object
- Object
- Jacuzzi
- Defined in:
- lib/jacuzzi.rb
Instance Attribute Summary collapse
-
#app_host ⇒ Object
Returns the value of attribute app_host.
-
#test_paths ⇒ Object
Returns the value of attribute test_paths.
-
#test_source ⇒ Object
Returns the value of attribute test_source.
Instance Method Summary collapse
- #cool ⇒ Object
- #heat ⇒ Object
-
#initialize ⇒ Jacuzzi
constructor
A new instance of Jacuzzi.
- #whirl ⇒ Object
Constructor Details
#initialize ⇒ Jacuzzi
Returns a new instance of Jacuzzi.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jacuzzi.rb', line 11 def initialize puts "Welcome to the jacuzzi -- who knows what bugs you'll catch?" @test_paths = [] puts "Building temporary directories ..." Dir.mkdir('.jacuzzi') Dir.mkdir('.jacuzzi/spec') Dir.mkdir('.jacuzzi/tmp') puts "Generating spec helper ..." spec_helper_content = <<HEREDOC RSpec.configure do |config| config.include Capybara::DSL end HEREDOC File.open('./.jacuzzi/spec/spec_helper.rb', 'w') {|file| file.write(spec_helper_content) } end |
Instance Attribute Details
#app_host ⇒ Object
Returns the value of attribute app_host.
9 10 11 |
# File 'lib/jacuzzi.rb', line 9 def app_host @app_host end |
#test_paths ⇒ Object
Returns the value of attribute test_paths.
9 10 11 |
# File 'lib/jacuzzi.rb', line 9 def test_paths @test_paths end |
#test_source ⇒ Object
Returns the value of attribute test_source.
9 10 11 |
# File 'lib/jacuzzi.rb', line 9 def test_source @test_source end |
Instance Method Details
#cool ⇒ Object
70 71 72 73 |
# File 'lib/jacuzzi.rb', line 70 def cool puts "Shut this mutha down (removing temporary files) ..." FileUtils.rm_rf './.jacuzzi' end |
#heat ⇒ Object
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 |
# File 'lib/jacuzzi.rb', line 31 def heat puts "Cranking up the heat (retrieving tests) ..." Git.clone("#{@test_source}", './.jacuzzi/tmp/tests') Find.find('./.jacuzzi/tmp/tests/') do |path| @test_paths << path if File.extname(path) == '.rb' end puts "Tests retrieved:" @test_paths.each do |path| FileUtils.cp path, "./.jacuzzi/spec/#{File.basename(path)}" end p @test_paths puts "Generating Capybara config settings ..." = <<HEREDOC require 'rspec' require 'capybara' require 'capybara/dsl' require './.jacuzzi/spec/spec_helper.rb' Capybara.default_driver = :selenium Capybara.app_host = "#{@app_host}" HEREDOC File.open('./.jacuzzi/spec/capybara_spec.rb', 'w') {|file| file.write() } end |
#whirl ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/jacuzzi.rb', line 60 def whirl puts "Start up the whirlpool, baybay (running the tests):" begin RSpec::Core::Runner.run(['./.jacuzzi/spec', '-c', '-f', 'documentation']) rescue puts 'Somebody took a shit in the jacuzzi.' end puts "Ahhhh ... How relaxing, to soak in the jacuzzi." end |