exam 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rvmrc +1 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +3 -0
- data/Rakefile +2 -0
- data/bin/exam +3 -0
- data/exam.gemspec +17 -0
- data/lib/exam.rb +29 -0
- data/lib/exam/suite.rb +17 -0
- data/lib/exam/task.rb +9 -0
- data/lib/exam/version.rb +3 -0
- data/spec/exam_spec.rb +56 -0
- metadata +62 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use ruby-1.9.3-p194@exam --create
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 TODO: Write your name
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/exam
ADDED
data/exam.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/exam/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Zac Clark", "Georg Apitz"]
|
6
|
+
gem.email = ["zac@pivotallabs.com", "georg@pivotallabs.com"]
|
7
|
+
gem.description = %q{A test suite runner for ruby.}
|
8
|
+
gem.summary = %q{Uses a Suitefile to run large test suites.}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "exam"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Exam::VERSION
|
17
|
+
end
|
data/lib/exam.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
class Exam
|
2
|
+
require "exam/version"
|
3
|
+
require "exam/suite"
|
4
|
+
require "exam/task"
|
5
|
+
|
6
|
+
attr_reader :suites
|
7
|
+
|
8
|
+
def initialize(&block)
|
9
|
+
@suites = []
|
10
|
+
@timing = false
|
11
|
+
instance_eval(&block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def timing?
|
15
|
+
@timing
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def suite(name, &block)
|
21
|
+
@suites << Suite.new(name, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def timing(choice)
|
25
|
+
if choice == true || choice == :on
|
26
|
+
@timing = true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/exam/suite.rb
ADDED
data/lib/exam/task.rb
ADDED
data/lib/exam/version.rb
ADDED
data/spec/exam_spec.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "rspec"
|
2
|
+
require "exam"
|
3
|
+
|
4
|
+
describe Exam do
|
5
|
+
it "should collect a set of test suites" do
|
6
|
+
exam = Exam.new do
|
7
|
+
suite "something" do
|
8
|
+
task "whatever"
|
9
|
+
end
|
10
|
+
|
11
|
+
suite "other" do
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
exam.suites.length.should == 2
|
17
|
+
exam.suites.first.name.should == "something"
|
18
|
+
exam.suites.last.name.should == "other"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should register tasks within suites" do
|
22
|
+
exam = Exam.new do
|
23
|
+
suite "something" do
|
24
|
+
task "whatever"
|
25
|
+
task "whenever"
|
26
|
+
task "wherever"
|
27
|
+
task "whoever"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
suite = exam.suites.first
|
32
|
+
|
33
|
+
suite.tasks.length.should == 4
|
34
|
+
suite.tasks[0].command.should == "whatever"
|
35
|
+
suite.tasks[1].command.should == "whenever"
|
36
|
+
suite.tasks[2].command.should == "wherever"
|
37
|
+
suite.tasks[3].command.should == "whoever"
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should register timing" do
|
41
|
+
exam = Exam.new {}
|
42
|
+
exam.timing?.should == false
|
43
|
+
|
44
|
+
exam = Exam.new { timing :on }
|
45
|
+
exam.timing?.should == true
|
46
|
+
|
47
|
+
exam = Exam.new { timing true }
|
48
|
+
exam.timing?.should == true
|
49
|
+
|
50
|
+
exam = Exam.new { timing :off }
|
51
|
+
exam.timing?.should == false
|
52
|
+
|
53
|
+
exam = Exam.new { timing false }
|
54
|
+
exam.timing?.should == false
|
55
|
+
end
|
56
|
+
end
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: exam
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Zac Clark
|
9
|
+
- Georg Apitz
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-10-09 00:00:00.000000000 Z
|
14
|
+
dependencies: []
|
15
|
+
description: A test suite runner for ruby.
|
16
|
+
email:
|
17
|
+
- zac@pivotallabs.com
|
18
|
+
- georg@pivotallabs.com
|
19
|
+
executables:
|
20
|
+
- exam
|
21
|
+
extensions: []
|
22
|
+
extra_rdoc_files: []
|
23
|
+
files:
|
24
|
+
- .gitignore
|
25
|
+
- .rvmrc
|
26
|
+
- Gemfile
|
27
|
+
- LICENSE
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- bin/exam
|
31
|
+
- exam.gemspec
|
32
|
+
- lib/exam.rb
|
33
|
+
- lib/exam/suite.rb
|
34
|
+
- lib/exam/task.rb
|
35
|
+
- lib/exam/version.rb
|
36
|
+
- spec/exam_spec.rb
|
37
|
+
homepage: ''
|
38
|
+
licenses: []
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements: []
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.8.24
|
58
|
+
signing_key:
|
59
|
+
specification_version: 3
|
60
|
+
summary: Uses a Suitefile to run large test suites.
|
61
|
+
test_files:
|
62
|
+
- spec/exam_spec.rb
|