purobu 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,7 @@ require 'singleton'
2
2
  module Purobu
3
3
  class Configuration
4
4
  include Singleton
5
+ include Purobu::Helpers::HelpersHelper
5
6
 
6
7
  # Run verbosely
7
8
  attr_accessor :verbose
@@ -12,18 +13,9 @@ module Purobu
12
13
  # Which test files to run
13
14
  attr_accessor :files
14
15
 
15
- # Global teardown to run after the entire suite
16
- attr_accessor :global_teardown
17
-
18
16
  # Heroku api key to be used by the heroku-api client
19
17
  attr_accessor :heroku_api_key
20
18
 
21
- def self.run(&block)
22
- self.instance.heroku_api_key = ENV['HEROKU_API_KEY']
23
-
24
- yield self.instance
25
- end
26
-
27
19
  def global_setup(&block)
28
20
  if block_given?
29
21
  @global_setup = block
@@ -40,6 +32,12 @@ module Purobu
40
32
  end
41
33
  end
42
34
 
35
+ def self.run(&block)
36
+ self.instance.heroku_api_key = ENV['HEROKU_API_KEY']
37
+
38
+ yield self.instance
39
+ end
40
+
43
41
  class << self
44
42
  def method_missing(method)
45
43
  if self.instance.respond_to?(method)
data/lib/purobu/test.rb CHANGED
@@ -25,12 +25,13 @@ module Purobu
25
25
  Purobu.log(verification: true) do
26
26
  @fail = !@verification.call
27
27
  end
28
- Purobu.log(teardown: true) do
29
- @teardowns.each { |s| s.call }
30
- end
31
28
  end
32
- rescue => e
29
+ rescue
33
30
  @fail = true
31
+ ensure
32
+ Purobu.log(teardown: true) do
33
+ @teardowns.each { |s| s.call }
34
+ end
34
35
  end
35
36
  pass?
36
37
  end
@@ -1,3 +1,3 @@
1
1
  module Purobu
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/purobu.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  require "purobu/version"
2
2
  require "purobu/log"
3
- require "purobu/configuration"
4
3
  require "purobu/test"
5
4
  require "purobu/runner"
6
5
  require "purobu/dsl"
7
6
  require "purobu/helpers"
8
- require "purobu/database_connection"
9
7
  require "purobu/heroku_helpers"
8
+ require "purobu/configuration"
9
+ require "purobu/database_connection"
10
10
  require "purobu/heroku"
11
11
  require "purobu/reporter"
@@ -0,0 +1,16 @@
1
+ require 'purobu'
2
+
3
+ describe Purobu::Configuration do
4
+ it 'allows you to add helpers' do
5
+ Purobu::Configuration.run do |config|
6
+ config.helpers do
7
+ def help
8
+ throw :a_helper
9
+ end
10
+ end
11
+ end
12
+
13
+ test = Purobu::Test.new
14
+ expect { test.help }.to throw_symbol :a_helper
15
+ end
16
+ end
@@ -27,6 +27,14 @@ describe Purobu::Test, '#run' do
27
27
 
28
28
  -> { test.run }.should throw_symbol :teardown
29
29
  end
30
+
31
+ it 'tears down even if something blows up earlier' do
32
+ test = Purobu::Test.new
33
+ test.verify { raise "oh noes" }
34
+ test.teardown { throw :teardown }
35
+
36
+ -> { test.run }.should throw_symbol :teardown
37
+ end
30
38
  end
31
39
 
32
40
  describe Purobu::Test, 'pass/fail' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: purobu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-26 00:00:00.000000000 Z
12
+ date: 2012-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: heroku
16
- requirement: &70206819644680 !ruby/object:Gem::Requirement
16
+ requirement: &70341729351560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.28.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70206819644680
24
+ version_requirements: *70341729351560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: heroku-api
27
- requirement: &70206819643240 !ruby/object:Gem::Requirement
27
+ requirement: &70341729350880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70206819643240
35
+ version_requirements: *70341729350880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: scrolls
38
- requirement: &70206819641660 !ruby/object:Gem::Requirement
38
+ requirement: &70341729349140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - =
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.2.1
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70206819641660
46
+ version_requirements: *70341729349140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sequel
49
- requirement: &70206819639980 !ruby/object:Gem::Requirement
49
+ requirement: &70341729347960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70206819639980
57
+ version_requirements: *70341729347960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &70206819639320 !ruby/object:Gem::Requirement
60
+ requirement: &70341729346800 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70206819639320
68
+ version_requirements: *70341729346800
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: fakefs
71
- requirement: &70206819638540 !ruby/object:Gem::Requirement
71
+ requirement: &70341729345820 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70206819638540
79
+ version_requirements: *70341729345820
80
80
  description: ! ' Black-box integration test framework for components on the Heroku
81
81
  platform. '
82
82
  email:
@@ -105,6 +105,7 @@ files:
105
105
  - lib/purobu/test.rb
106
106
  - lib/purobu/version.rb
107
107
  - purobu.gemspec
108
+ - spec/purobu/configuration_spec.rb
108
109
  - spec/purobu/database_connection_spec.rb
109
110
  - spec/purobu/dsl_spec.rb
110
111
  - spec/purobu/helpers_spec.rb
@@ -136,6 +137,7 @@ signing_key:
136
137
  specification_version: 3
137
138
  summary: Black-box integration test framework for components on the Heroku platform.
138
139
  test_files:
140
+ - spec/purobu/configuration_spec.rb
139
141
  - spec/purobu/database_connection_spec.rb
140
142
  - spec/purobu/dsl_spec.rb
141
143
  - spec/purobu/helpers_spec.rb