protest 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,7 @@ Protest.
30
30
 
31
31
  Or
32
32
 
33
- rip install git://github.com/foca/protest.git v0.2.3
33
+ rip install git://github.com/matflores/protest.git v0.3.0
34
34
 
35
35
  == Setup and teardown
36
36
 
data/Rakefile CHANGED
@@ -19,6 +19,8 @@ begin
19
19
  rescue LoadError
20
20
  end
21
21
 
22
- Rake::TestTask.new
22
+ Rake::TestTask.new do |t|
23
+ t.libs << "test"
24
+ end
23
25
 
24
26
  task :default => :test
@@ -1,5 +1,5 @@
1
1
  module Protest
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
 
4
4
  # Exception raised when an assertion fails. See TestCase#assert
5
5
  class AssertionFailed < StandardError; end
@@ -31,7 +31,7 @@ module Protest
31
31
  rescue LoadError
32
32
  end
33
33
 
34
- # Run all tests in this context. Takes a Report instance in order to
34
+ # Run all tests in this context. Takes a Runner instance in order to
35
35
  # provide output.
36
36
  def self.run(runner)
37
37
  runner.report(TestWrapper.new(:setup, self), true)
@@ -49,8 +49,8 @@ module Protest
49
49
  @tests ||= []
50
50
  end
51
51
 
52
- # Add a test to be run in this context. This method is aliased as +it+ and
53
- # +should+ for your comfort.
52
+ # Add a test to be run in this context. This method is aliased as +it+,
53
+ # +should+ and +scenario+ for your comfort.
54
54
  def self.test(name, &block)
55
55
  tests << new(name, caller.at(0), &block)
56
56
  end
@@ -78,6 +78,8 @@ module Protest
78
78
  # state set on this operations. For example, creating large amount of
79
79
  # records in a database or filesystem, when your tests will only read these
80
80
  # records.
81
+ #
82
+ # This method is aliased as +before_all+ for your comfort.
81
83
  def self.global_setup(&block)
82
84
  (class << self; self; end).class_eval do
83
85
  define_method :do_global_setup do
@@ -106,6 +108,8 @@ module Protest
106
108
  #
107
109
  # See TestCase.global_setup for a discussion on why these methods are best
108
110
  # avoided unless you really need them and use them carefully.
111
+ #
112
+ # This method is aliased as +after_all+ for your comfort.
109
113
  def self.global_teardown(&block)
110
114
  (class << self; self; end).class_eval do
111
115
  define_method :do_global_teardown do
@@ -117,7 +121,8 @@ module Protest
117
121
 
118
122
  # Define a new test context nested under the current one. All +setup+ and
119
123
  # +teardown+ blocks defined on the current context will be inherited by the
120
- # new context. This method is aliased as +describe+ for your comfort.
124
+ # new context. This method is aliased as +describe+ and +story+ for your
125
+ # comfort.
121
126
  def self.context(description, &block)
122
127
  subclass = Class.new(self)
123
128
  subclass.class_eval(&block) if block
@@ -137,7 +142,7 @@ module Protest
137
142
  alias_method :after, :teardown
138
143
 
139
144
  alias_method :before_all, :global_setup
140
- alias_method :after_all, :global_setup
145
+ alias_method :after_all, :global_teardown
141
146
 
142
147
  alias_method :it, :test
143
148
  alias_method :should, :test
@@ -173,7 +178,7 @@ module Protest
173
178
  # condition isn't met. You can override the default failure message
174
179
  # by passing it as an argument.
175
180
  def assert(condition, message="Expected condition to be satisfied")
176
- @report.add_assertion
181
+ @report.on_assertion
177
182
  raise AssertionFailed, message unless condition
178
183
  end
179
184
 
@@ -51,13 +51,13 @@ module Protest
51
51
  # (unrescued exceptions), including file and line number where the test
52
52
  # failed, and a short backtrace.
53
53
  #
54
- # It will not output anything if there weren't any pending tests.
54
+ # It will not output anything if there weren't any failures or errors.
55
55
  #
56
56
  # For example:
57
57
  #
58
58
  # on :end do |report|
59
59
  # report.puts
60
- # report.summarize_pending_tests
60
+ # report.summarize_errors
61
61
  # end
62
62
  #
63
63
  # This relies on the public Report API, and on the presence of a #puts
@@ -106,7 +106,7 @@ module Protest
106
106
  end
107
107
 
108
108
  def test_type(test)
109
- case test # order is important since ErroredTest < FailedTest
109
+ case test
110
110
  when ErroredTest; "Error"
111
111
  when FailedTest; "Failure"
112
112
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "protest"
3
- s.version = "0.2.3"
4
- s.date = "2009-11-14"
3
+ s.version = "0.3.0"
4
+ s.date = "2010-03-11"
5
5
 
6
6
  s.description = "Protest is a tiny, simple, and easy-to-extend test framework"
7
7
  s.summary = s.description
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - "Nicol\xC3\xA1s Sanguinetti"
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-11-14 00:00:00 -08:00
17
+ date: 2010-03-11 00:00:00 -03:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -53,18 +58,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
58
  requirements:
54
59
  - - ">="
55
60
  - !ruby/object:Gem::Version
61
+ segments:
62
+ - 0
56
63
  version: "0"
57
- version:
58
64
  required_rubygems_version: !ruby/object:Gem::Requirement
59
65
  requirements:
60
66
  - - ">="
61
67
  - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
62
70
  version: "0"
63
- version:
64
71
  requirements: []
65
72
 
66
73
  rubyforge_project: protest
67
- rubygems_version: 1.3.5
74
+ rubygems_version: 1.3.6
68
75
  signing_key:
69
76
  specification_version: 3
70
77
  summary: Protest is a tiny, simple, and easy-to-extend test framework