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.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jacuzzi.rb', line 8 def initialize puts "Welcome to the jacuzzi -- who knows what bugs you'll catch?" @test_paths = [] puts "Building temporary directories ..." %x[mkdir ./.jacuzzi] %x[mkdir ./.jacuzzi/spec] %x[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.
6 7 8 |
# File 'lib/jacuzzi.rb', line 6 def app_host @app_host end |
#test_paths ⇒ Object
Returns the value of attribute test_paths.
6 7 8 |
# File 'lib/jacuzzi.rb', line 6 def test_paths @test_paths end |
#test_source ⇒ Object
Returns the value of attribute test_source.
6 7 8 |
# File 'lib/jacuzzi.rb', line 6 def test_source @test_source end |
Instance Method Details
#cool ⇒ Object
63 64 65 66 |
# File 'lib/jacuzzi.rb', line 63 def cool puts "Shut this mutha down (removing temporary files) ..." %x[rm -rf ./.jacuzzi] end |
#heat ⇒ Object
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 |
# File 'lib/jacuzzi.rb', line 28 def heat puts "Cranking up the heat (retrieving tests) ..." %x[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| %x[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
57 58 59 60 61 |
# File 'lib/jacuzzi.rb', line 57 def whirl puts "Start up the whirlpool, baybay (running the tests):" %x[rspec ./.jacuzzi/spec -c -f documentation] puts "Ahhhh ... How relaxing, to sit in the jacuzzi." end |