nutrasuite 0.1.2 → 0.1.3

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.
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList['test/unit/*_test.rb']
7
+ t.verbose = true
8
+ end
@@ -86,33 +86,31 @@ module Nutrasuite
86
86
 
87
87
  def self.build_test_name(name="")
88
88
  full_name = "test "
89
- @context_stack.each do |context|
89
+ context_stack.each do |context|
90
90
  full_name << context.name << " "
91
91
  end
92
92
  full_name << name
93
93
  end
94
94
 
95
95
  def self.push(name, &block)
96
- @context_stack ||= []
97
-
98
96
  context = Context.new(name, &block)
99
- @context_stack.push(context)
97
+ context_stack.push(context)
100
98
 
101
99
  context.build
102
100
 
103
- @context_stack.pop
101
+ context_stack.pop
104
102
  end
105
103
 
106
104
  def self.context_stack
107
- @context_stack
105
+ @context_stack ||= []
108
106
  end
109
107
 
110
108
  def self.current_context
111
- @context_stack.last
109
+ context_stack.last
112
110
  end
113
111
 
114
112
  def self.current_context?
115
- !@context_stack.empty?
113
+ !context_stack.empty?
116
114
  end
117
115
  end
118
116
  end
@@ -1,3 +1,3 @@
1
1
  module Nutrasuite
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -0,0 +1,3 @@
1
+ require 'test/unit'
2
+
3
+ require 'nutrasuite'
@@ -0,0 +1,80 @@
1
+ require 'test_helper'
2
+
3
+ class ContextsTest < Test::Unit::TestCase
4
+ it "allows tests outside of any context" do
5
+ assert true
6
+ end
7
+
8
+ it_eventually "allows tests to be skipped outside of any context" do
9
+ raise "This exception should never be thrown."
10
+ end
11
+
12
+ it "names tests correctly" do
13
+ assert_equal "test some name", Nutrasuite::Context.build_test_name("some name")
14
+ end
15
+
16
+ a "Context" do
17
+ setup do
18
+ @a = 5
19
+ end
20
+
21
+ it "runs setups before tests" do
22
+ assert_equal @a, 5
23
+ end
24
+
25
+ it_eventually "passes its name onto its tests" do
26
+ # TODO: figure out how to test this
27
+ end
28
+
29
+ that "has a nested Context" do
30
+ setup do
31
+ @b = 10
32
+ end
33
+
34
+ it "runs both setups" do
35
+ assert_equal @a, 5
36
+ assert_equal @b, 10
37
+ end
38
+ end
39
+
40
+ that "has a nested Context with multiple setups" do
41
+ setup do
42
+ @b = 6
43
+ end
44
+
45
+ setup do
46
+ @c = 7
47
+ @b = @b + 1
48
+ end
49
+
50
+ it "runs all setups in order" do
51
+ assert_equal @b, 7
52
+ assert_equal @b, @c
53
+ end
54
+ end
55
+ end
56
+
57
+ the "'the' context" do
58
+ it "works" do
59
+ assert true
60
+ end
61
+ end
62
+
63
+ the "'and' context" do
64
+ it "works" do
65
+ assert true
66
+ end
67
+ end
68
+
69
+ the "'an' context" do
70
+ it "works" do
71
+ assert true
72
+ end
73
+ end
74
+
75
+ the "'that' context" do
76
+ it "works" do
77
+ assert true
78
+ end
79
+ end
80
+ 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.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-02-24 00:00:00.000000000 Z
13
+ date: 2012-02-25 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Nutrasuite is a low-calorie syntax sweetener for minitest
16
16
  email:
@@ -28,6 +28,8 @@ files:
28
28
  - lib/nutrasuite/contexts.rb
29
29
  - lib/nutrasuite/version.rb
30
30
  - nutrasuite.gemspec
31
+ - test/test_helper.rb
32
+ - test/unit/contexts_test.rb
31
33
  homepage: http://github.com/duwanis/nutrasuite
32
34
  licenses: []
33
35
  post_install_message:
@@ -52,5 +54,7 @@ rubygems_version: 1.8.15
52
54
  signing_key:
53
55
  specification_version: 3
54
56
  summary: Nutrasuite is a low-calorie syntax sweetener for minitest
55
- test_files: []
57
+ test_files:
58
+ - test/test_helper.rb
59
+ - test/unit/contexts_test.rb
56
60
  has_rdoc: