Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Can get your legions from the Hellspawn class

  • Loading branch information...
commit a5b467a4a3590f2141598c15e0116dc054c0a455 1 parent 0539652
Michael Sofaer and Raphael Sofaer authored

Showing 2 changed files with 24 additions and 15 deletions. Show diff stats Hide diff stats

  1. +6 1 lib/hellspawn.rb
  2. +18 14 test/hellspawn_test.rb
7 lib/hellspawn.rb
... ... @@ -1,7 +1,12 @@
1 1 class Hellspawn
  2 + @@legions = []
2 3 def self.legion(options)
3   - Legion.new(options)
  4 + legion = Legion.new(options)
  5 + @@legions << legion
  6 + legion
4 7 end
  8 + def self.legions; @@legions; end
  9 + def self.legions=(value); @@legions = value; end #for_test
5 10 class Legion < Array
6 11 def initialize(options)
7 12 @options = options
32 test/hellspawn_test.rb
@@ -2,20 +2,21 @@
2 2 require 'lib/hellspawn'
3 3
4 4 class BasicTest < Test::Unit::TestCase
5   - def setup
6   - @thin = {:name => "thin",
7   - :executable => "/usr/local/bin/thin",
8   - :flags => {"-e" => "production",
9   - "-c" => "/usr/local/app/my_app",
10   - },
11   - }
12   - @base = "/tmp/test_services"
13   - @legion = Hellspawn.legion(:base => @base,
14   - :log_dir => "/tmp/test_services_log")
15   - end
16   - def teardown
17   - FileUtils.rm_rf @base
18   - end
  5 + def setup
  6 + @thin = {:name => "thin",
  7 + :executable => "/usr/local/bin/thin",
  8 + :flags => {"-e" => "production",
  9 + "-c" => "/usr/local/app/my_app",
  10 + },
  11 + }
  12 + @base = "/tmp/test_services"
  13 + @legion = Hellspawn.legion(:base => @base,
  14 + :log_dir => "/tmp/test_services_log")
  15 + end
  16 + def teardown
  17 + FileUtils.rm_rf @base
  18 + Hellspawn.legions = []
  19 + end
19 20 def test_legion
20 21 assert {@legion.size == 0}
21 22 end
@@ -76,4 +77,7 @@ def test_squad_by_flag
76 77 assert {File.read("#{@base}/thin_8006/run").match /thin .* -p 8006/ }
77 78 assert {File.read("#{@base}/thin_8007/run").match /thin .* -p 8007/ }
78 79 end
  80 + def test_get_legion
  81 + assert { Hellspawn.legions == [@legion] }
  82 + end
79 83 end

0 comments on commit a5b467a

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