minitest-given 0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
data/.autotest ADDED
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.extra_files << "../some/external/dependency.rb"
7
+ #
8
+ # at.libs << ":../some/external"
9
+ #
10
+ # at.add_exception 'vendor'
11
+ #
12
+ # at.add_mapping(/dependency.rb/) do |f, _|
13
+ # at.files_matching(/test_.*rb$/)
14
+ # end
15
+ #
16
+ # %w(TestA TestB).each do |klass|
17
+ # at.extra_class_map[klass] = "test/test_misc.rb"
18
+ # end
19
+ # end
20
+
21
+ # Autotest.add_hook :run_command do |at|
22
+ # system "rake build"
23
+ # end
data/.gemtest ADDED
File without changes
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ === 0.1 / ???
2
+
3
+ Hello world!
data/Manifest.txt ADDED
@@ -0,0 +1,11 @@
1
+ .autotest
2
+ CHANGELOG.rdoc
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ lib/minitest-given.rb
7
+ lib/minitest/given.rb
8
+ minitest-given.gemspec
9
+ test/test_assertions.rb
10
+ test/test_comparison.rb
11
+ test/test_version.rb
data/README.rdoc ADDED
@@ -0,0 +1,48 @@
1
+ = minitest-given
2
+
3
+ Given/When/Then built on top of minitest's spec DSL.
4
+
5
+ == Install
6
+
7
+ gem install minitest-given
8
+
9
+ == Configure
10
+
11
+ Add the following to your test or helper:
12
+
13
+ require "minitest/rails/capybara"
14
+
15
+ == Usage
16
+
17
+ minitest-given is intended to bring Jim Weirich's Given DSL to the land of minitest.
18
+
19
+ https://github.com/jimweirich/rspec-given
20
+
21
+ == Get Involved
22
+
23
+ Join the mailing list to get help or offer suggestions.
24
+
25
+ https://groups.google.com/group/minitest-rails
26
+
27
+ == License
28
+
29
+ Copyright (c) 2013 Mike Moore
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ "Software"), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
45
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
46
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
47
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
48
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require "rubygems"
2
+ require "hoe"
3
+
4
+ Hoe.plugin :gemspec
5
+ Hoe.plugin :git
6
+ Hoe.plugin :minitest
7
+
8
+ Hoe.spec "minitest-given" do
9
+ developer "Mike Moore", "mike@blowmage.com"
10
+
11
+ self.summary = "Given/When/Then for minitest"
12
+ self.description = "Adds Given/When/Then built on top of minitest's spec DSL."
13
+ self.urls = ["http://blowmage.com/minitest-given"]
14
+
15
+ self.history_file = "CHANGELOG.rdoc"
16
+ self.readme_file = "README.rdoc"
17
+ self.testlib = :minitest
18
+
19
+ dependency "minitest", ">= 4.4.0"
20
+ dependency "wrong", ">= 0.6.3"
21
+ end
@@ -0,0 +1,32 @@
1
+ require "minitest/unit"
2
+ require "minitest/spec"
3
+ # require "wrong/adapters/minitest"
4
+
5
+ module MiniTest
6
+ module Given
7
+ VERSION = "0.1.pre"
8
+ end
9
+
10
+ class Spec
11
+ def self.Given *args, &block
12
+ if args.first.is_a? Symbol
13
+ self.let args.first, &block
14
+ else
15
+ self.before(&block)
16
+ end
17
+ end
18
+
19
+ def self.Then &block
20
+ # I want to call wrong's assert passing the block!
21
+ # I don't want to call the standard assert here.
22
+ it { assert instance_eval(&block) }
23
+ end
24
+
25
+ class << self
26
+ alias :context :describe
27
+ alias :Context :describe
28
+ alias :When :Given
29
+ alias :And :Then
30
+ end
31
+ end
32
+ end
@@ -0,0 +1 @@
1
+ require "minitest/given"
@@ -0,0 +1,42 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "minitest-given"
5
+ s.version = "0.1.pre.20130118205038"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Mike Moore"]
9
+ s.date = "2013-01-19"
10
+ s.description = "Adds Given/When/Then built on top of minitest's spec DSL."
11
+ s.email = ["mike@blowmage.com"]
12
+ s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc"]
13
+ s.files = [".autotest", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "lib/minitest-given.rb", "lib/minitest/given.rb", "minitest-given.gemspec", "test/test_assertions.rb", "test/test_comparison.rb", "test/test_version.rb", ".gemtest"]
14
+ s.homepage = "http://blowmage.com/minitest-given"
15
+ s.rdoc_options = ["--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = "minitest-given"
18
+ s.rubygems_version = "1.8.23"
19
+ s.summary = "Given/When/Then for minitest"
20
+ s.test_files = ["test/test_assertions.rb", "test/test_comparison.rb", "test/test_version.rb"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<minitest>, [">= 4.4.0"])
27
+ s.add_runtime_dependency(%q<wrong>, [">= 0.6.3"])
28
+ s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
29
+ s.add_development_dependency(%q<hoe>, ["~> 3.4"])
30
+ else
31
+ s.add_dependency(%q<minitest>, [">= 4.4.0"])
32
+ s.add_dependency(%q<wrong>, [">= 0.6.3"])
33
+ s.add_dependency(%q<rdoc>, ["~> 3.10"])
34
+ s.add_dependency(%q<hoe>, ["~> 3.4"])
35
+ end
36
+ else
37
+ s.add_dependency(%q<minitest>, [">= 4.4.0"])
38
+ s.add_dependency(%q<wrong>, [">= 0.6.3"])
39
+ s.add_dependency(%q<rdoc>, ["~> 3.10"])
40
+ s.add_dependency(%q<hoe>, ["~> 3.4"])
41
+ end
42
+ end
@@ -0,0 +1,30 @@
1
+ require "minitest/autorun"
2
+ require "minitest/given"
3
+
4
+ describe MiniTest::Given do
5
+
6
+ context "assertions" do
7
+ Given { }
8
+ When { }
9
+ Then { assert_equal 1, 1 }
10
+ And { assert_operator 1, :>, 0.5 }
11
+ And { assert 1 < 1.5, "1 is less than 1.5, right? RIGHT?" }
12
+ end
13
+
14
+ context "expectations" do
15
+ Given { }
16
+ When { }
17
+ Then { 1.must_equal 1 }
18
+ And { 1.must_be :>, 0.5 }
19
+ And { 1.must_be :<, 1.5 }
20
+ end
21
+
22
+ context "implicit" do
23
+ Given { }
24
+ When { }
25
+ Then { 1 == 1 }
26
+ And { 1 > 0.5 }
27
+ And { 1 < 1.5 }
28
+ end
29
+
30
+ end
@@ -0,0 +1,25 @@
1
+ require "minitest/autorun"
2
+ require "minitest/given"
3
+
4
+ describe MiniTest::Given do
5
+
6
+ Context :comparison do
7
+ Given(:a) { 1 }
8
+
9
+ Context "equals" do
10
+ When(:b) { 1 }
11
+ Then { a == b }
12
+ end
13
+
14
+ Context "greater than" do
15
+ When(:b) { 0.5 }
16
+ Then { a > b }
17
+ end
18
+
19
+ Context "less than" do
20
+ When(:b) { 1.5 }
21
+ Then { a < b }
22
+ end
23
+ end
24
+
25
+ end
@@ -0,0 +1,10 @@
1
+ require "minitest/autorun"
2
+ require "minitest/given"
3
+
4
+ describe MiniTest::Given, :version do
5
+ Given(:version) { MiniTest::Given::VERSION }
6
+ When(:low_version) { "0.0.1alpha000" }
7
+ When(:high_version) { "9999999.999999.9999" }
8
+ Then { version > low_version }
9
+ And { version < high_version }
10
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: minitest-given
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: 4
5
+ version: 0.1.pre
6
+ platform: ruby
7
+ authors:
8
+ - Mike Moore
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ none: false
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 4.4.0
21
+ name: minitest
22
+ type: :runtime
23
+ prerelease: false
24
+ requirement: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 4.4.0
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: 0.6.3
37
+ name: wrong
38
+ type: :runtime
39
+ prerelease: false
40
+ requirement: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.6.3
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ~>
51
+ - !ruby/object:Gem::Version
52
+ version: '3.10'
53
+ name: rdoc
54
+ type: :development
55
+ prerelease: false
56
+ requirement: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.10'
62
+ - !ruby/object:Gem::Dependency
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '3.4'
69
+ name: hoe
70
+ type: :development
71
+ prerelease: false
72
+ requirement: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '3.4'
78
+ description: Adds Given/When/Then built on top of minitest's spec DSL.
79
+ email:
80
+ - mike@blowmage.com
81
+ executables: []
82
+ extensions: []
83
+ extra_rdoc_files:
84
+ - CHANGELOG.rdoc
85
+ - Manifest.txt
86
+ - README.rdoc
87
+ files:
88
+ - .autotest
89
+ - CHANGELOG.rdoc
90
+ - Manifest.txt
91
+ - README.rdoc
92
+ - Rakefile
93
+ - lib/minitest-given.rb
94
+ - lib/minitest/given.rb
95
+ - minitest-given.gemspec
96
+ - test/test_assertions.rb
97
+ - test/test_comparison.rb
98
+ - test/test_version.rb
99
+ - .gemtest
100
+ homepage: http://blowmage.com/minitest-given
101
+ licenses: []
102
+ post_install_message:
103
+ rdoc_options:
104
+ - --main
105
+ - README.rdoc
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ! '>'
118
+ - !ruby/object:Gem::Version
119
+ version: 1.3.1
120
+ requirements: []
121
+ rubyforge_project: minitest-given
122
+ rubygems_version: 1.8.23
123
+ signing_key:
124
+ specification_version: 3
125
+ summary: Given/When/Then for minitest
126
+ test_files:
127
+ - test/test_assertions.rb
128
+ - test/test_comparison.rb
129
+ - test/test_version.rb