nutrasuite 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ 0.3.1 [03/18/2012]
2
+ Root contexts were kind of a dumb idea it turns out. Found an alternate way to
3
+ implement similar functionality.
4
+ 0.3.0 [03/07/2012]
5
+ Change log started. Better late than never.
6
+ Removed deprecated "setup" and "teardown" methods.
7
+ Introduced the concept of a root context so "before" and "after" methods can
8
+ exist outside of a declared context.
9
+ Replaced the ill-conceived "and" method with "and_also" courtesy @gma.
@@ -75,7 +75,8 @@ Gem requirements/etc. should be handled by Bundler.
75
75
 
76
76
  ### Contributors
77
77
 
78
- Alan Johnson (commondream)
78
+ - Alan Johnson (commondream)
79
+ - Graham Ashton (gma)
79
80
 
80
81
  ## License
81
82
  Copyright (C) 2012 by Tommy Morgan
@@ -3,7 +3,6 @@ module Nutrasuite
3
3
  # Public: ContextHelpers contains all of the Nutrasuite Context methods. This
4
4
  # will be included in Test::Unit::TestCase by default.
5
5
  module ContextHelpers
6
-
7
6
  # Public: These methods will each define a context and push it onto the
8
7
  # context stack for the duration of the passed in block.
9
8
  #
@@ -32,7 +31,12 @@ module Nutrasuite
32
31
  # Public: use before to declare steps that need to be run before every test
33
32
  # in a context.
34
33
  def before(&block)
35
- Context.current_context.setups << block
34
+ if Context.current_context
35
+ Context.current_context.setups << block
36
+ else
37
+ puts self.name + " is adding a hook"
38
+ self.add_setup_hook(nil, &block)
39
+ end
36
40
  end
37
41
 
38
42
  # Public: use after to declare steps that need to be run after every test in
@@ -89,6 +93,11 @@ module Nutrasuite
89
93
  test_name = Context.build_test_name(name)
90
94
 
91
95
  setups = []
96
+ # Be sure to include setup hooks from minitest.
97
+ unless @setup_hooks.nil?
98
+ setups = setups + @setup_hooks
99
+ end
100
+
92
101
  teardowns = []
93
102
  Context.context_stack.each do |context|
94
103
  setups.concat(context.setups)
@@ -188,7 +197,7 @@ module Nutrasuite
188
197
  #
189
198
  # Returns: an Array representing the context stack.
190
199
  def self.context_stack
191
- @context_stack ||= [Context.new(nil)]
200
+ @context_stack ||= []
192
201
  end
193
202
 
194
203
  # Internal: get the current context.
@@ -1,3 +1,3 @@
1
1
  module Nutrasuite
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -98,3 +98,11 @@ class ContextsTest < Test::Unit::TestCase
98
98
  end
99
99
  end
100
100
  end
101
+
102
+ class SecondTest < Test::Unit::TestCase
103
+ a "Second test class" do
104
+ it "isn't affected by befores from the first class" do
105
+ assert_equal nil, @root
106
+ end
107
+ end
108
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutrasuite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-03-07 00:00:00.000000000 Z
13
+ date: 2012-03-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
17
- requirement: &70199395886180 !ruby/object:Gem::Requirement
17
+ requirement: &70261346101020 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70199395886180
25
+ version_requirements: *70261346101020
26
26
  description: Nutrasuite is a low-calorie syntax sweetener for minitest
27
27
  email:
28
28
  - tommy.morgan@gmail.com
@@ -32,6 +32,7 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - .gitignore
35
+ - Changelog
35
36
  - Gemfile
36
37
  - README.markdown
37
38
  - Rakefile