contest 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -26
- data/lib/contest.rb +2 -2
- data/test/all_test.rb +9 -2
- data/test/setup_and_teardown_order_test.rb +2 -1
- metadata +6 -7
data/Rakefile
CHANGED
@@ -1,11 +1,5 @@
|
|
1
1
|
require 'rake'
|
2
|
-
require 'rake/gempackagetask'
|
3
2
|
require 'rake/testtask'
|
4
|
-
require 'rake/clean'
|
5
|
-
|
6
|
-
gem_spec_file = 'contest.gemspec'
|
7
|
-
|
8
|
-
gem_spec = eval(File.read(gem_spec_file)) rescue nil
|
9
3
|
|
10
4
|
task :default => :test
|
11
5
|
|
@@ -13,23 +7,3 @@ Rake::TestTask.new(:test) do |t|
|
|
13
7
|
t.pattern = 'test/**/*_test.rb'
|
14
8
|
t.verbose = false
|
15
9
|
end
|
16
|
-
|
17
|
-
Rake::GemPackageTask.new(gem_spec) do |pkg|
|
18
|
-
pkg.need_zip = false
|
19
|
-
pkg.need_tar = false
|
20
|
-
rm_f FileList['pkg/**/*.*']
|
21
|
-
end if gem_spec
|
22
|
-
|
23
|
-
desc "Generate the gemspec file."
|
24
|
-
task :gemspec do
|
25
|
-
require 'erb'
|
26
|
-
|
27
|
-
File.open(gem_spec_file, 'w') do |f|
|
28
|
-
f.write ERB.new(File.read("#{gem_spec_file}.erb")).result(binding)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
desc "Builds and installs the gem."
|
33
|
-
task :install => :repackage do
|
34
|
-
`sudo gem install pkg/#{gem_spec.name}-#{gem_spec.version}.gem`
|
35
|
-
end
|
data/lib/contest.rb
CHANGED
@@ -30,11 +30,11 @@ class Test::Unit::TestCase
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.context(name, &block)
|
33
|
+
def self.context(*name, &block)
|
34
34
|
subclass = Class.new(self)
|
35
35
|
remove_tests(subclass)
|
36
36
|
subclass.class_eval(&block) if block_given?
|
37
|
-
const_set(context_name(name), subclass)
|
37
|
+
const_set(context_name(name.join(" ")), subclass)
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.test(name, &block)
|
data/test/all_test.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path(File.join("..", "lib", "contest"),
|
2
|
+
File.dirname(__FILE__))
|
2
3
|
|
3
4
|
class FooTest < Test::Unit::TestCase
|
4
5
|
setup do
|
@@ -19,6 +20,12 @@ class FooTest < Test::Unit::TestCase
|
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
23
|
+
context "context", "with multiple", "arguments", 123, FooTest do
|
24
|
+
should "run the test inside" do
|
25
|
+
assert_equal 1, @value
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
22
29
|
context "some context" do
|
23
30
|
setup do
|
24
31
|
@value += 1
|
@@ -74,7 +81,7 @@ class BarTest < Test::Unit::TestCase
|
|
74
81
|
assert_equal 2, @value
|
75
82
|
end
|
76
83
|
|
77
|
-
test "another truth" do
|
84
|
+
test "yet another truth" do
|
78
85
|
assert_equal 2, @value
|
79
86
|
end
|
80
87
|
end
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.3
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Damian Janowski
|
@@ -10,8 +11,7 @@ autorequire:
|
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
13
|
|
13
|
-
date:
|
14
|
-
default_executable:
|
14
|
+
date: 2011-05-08 00:00:00 Z
|
15
15
|
dependencies: []
|
16
16
|
|
17
17
|
description: Write declarative tests using nested contexts without performance penalties. Contest is less than 100 lines of code and gets the job done.
|
@@ -32,7 +32,6 @@ files:
|
|
32
32
|
- rails/init.rb
|
33
33
|
- test/all_test.rb
|
34
34
|
- test/setup_and_teardown_order_test.rb
|
35
|
-
has_rdoc: true
|
36
35
|
homepage: http://github.com/citrusbyte/contest
|
37
36
|
licenses: []
|
38
37
|
|
@@ -42,21 +41,21 @@ rdoc_options: []
|
|
42
41
|
require_paths:
|
43
42
|
- lib
|
44
43
|
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
45
|
requirements:
|
46
46
|
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: "0"
|
49
|
-
version:
|
50
49
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: "0"
|
55
|
-
version:
|
56
55
|
requirements: []
|
57
56
|
|
58
57
|
rubyforge_project: contest
|
59
|
-
rubygems_version: 1.
|
58
|
+
rubygems_version: 1.8.1
|
60
59
|
signing_key:
|
61
60
|
specification_version: 3
|
62
61
|
summary: Write more readable tests in Test::Unit with this tiny script.
|