rspec-given 2.4.5 → 3.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -2
- data/Gemfile.lock +8 -10
- data/README.md +50 -34
- data/README.old +720 -0
- data/Rakefile +23 -17
- data/TODO +13 -0
- data/examples/example_helper.rb +8 -1
- data/examples/integration/and_spec.rb +6 -11
- data/examples/integration/focused_line_spec.rb +2 -1
- data/examples/integration/given_spec.rb +19 -9
- data/examples/integration/invariant_spec.rb +6 -6
- data/examples/integration/then_spec.rb +0 -1
- data/examples/loader.rb +4 -0
- data/examples/minitest_helper.rb +38 -0
- data/examples/stack/stack_spec.rb +2 -3
- data/lib/given.rb +2 -0
- data/lib/rspec/given.rb +1 -19
- data/rakelib/bundler_fix.rb +17 -0
- data/rakelib/gemspec.rake +161 -0
- data/rakelib/metrics.rake +30 -0
- data/rakelib/preview.rake +14 -0
- data/spec/lib/{rspec/given → given}/evaluator_spec.rb +1 -1
- data/spec/lib/{rspec/given → given}/ext/numeric_spec.rb +2 -2
- data/spec/lib/{rspec/given → given}/ext/numeric_specifications.rb +0 -0
- data/spec/lib/{rspec/given → given}/extensions_spec.rb +2 -2
- data/spec/lib/given/failure_matcher_spec.rb +77 -0
- data/spec/lib/given/failure_spec.rb +49 -0
- data/spec/lib/given/file_cache_spec.rb +26 -0
- data/spec/lib/{rspec/given → given}/fuzzy_number_spec.rb +2 -2
- data/spec/lib/{rspec/given → given}/have_failed_spec.rb +5 -4
- data/spec/lib/{rspec/given → given}/lexical_purity_spec.rb +0 -0
- data/spec/lib/given/line_extractor_spec.rb +84 -0
- data/spec/lib/{rspec/given → given}/module_methods_spec.rb +2 -2
- data/spec/lib/{rspec/given → given}/natural_assertion_spec.rb +4 -36
- data/spec/lib/{rspec/given → given}/options_spec.rb +33 -33
- data/spec/spec_helper.rb +20 -0
- data/spec/support/faux_then.rb +2 -2
- data/spec/support/natural_assertion_control.rb +1 -1
- metadata +35 -42
- data/examples/integration/failing_spec.rb +0 -5
- data/lib/rspec/given/configure.rb +0 -20
- data/lib/rspec/given/core.rb +0 -9
- data/lib/rspec/given/evaluator.rb +0 -39
- data/lib/rspec/given/ext/numeric.rb +0 -32
- data/lib/rspec/given/extensions.rb +0 -262
- data/lib/rspec/given/failure.rb +0 -53
- data/lib/rspec/given/file_cache.rb +0 -19
- data/lib/rspec/given/fuzzy_number.rb +0 -70
- data/lib/rspec/given/fuzzy_shortcuts.rb +0 -1
- data/lib/rspec/given/have_failed.rb +0 -77
- data/lib/rspec/given/line_extractor.rb +0 -43
- data/lib/rspec/given/module_methods.rb +0 -70
- data/lib/rspec/given/monkey.rb +0 -42
- data/lib/rspec/given/natural_assertion.rb +0 -193
- data/lib/rspec/given/rspec1_given.rb +0 -11
- data/lib/rspec/given/version.rb +0 -10
- data/spec/lib/rspec/given/failure_spec.rb +0 -17
- data/spec/lib/rspec/given/file_cache_spec.rb +0 -28
- data/spec/lib/rspec/given/line_extractor_spec.rb +0 -86
data/Rakefile
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
#!/usr/bin/ruby -wKU
|
2
2
|
|
3
3
|
require 'rake/clean'
|
4
|
-
require './lib/
|
5
|
-
require './lib/
|
4
|
+
require './lib/given/version'
|
5
|
+
require './lib/given/module_methods'
|
6
6
|
|
7
7
|
CLEAN.include("pkg/rspec-given-*").exclude("pkg/*.gem")
|
8
8
|
CLOBBER.include("*.gemspec", "html", "README", "README.old")
|
9
9
|
|
10
10
|
# README Formatting --------------------------------------------------
|
11
11
|
|
12
|
-
task :default => :
|
12
|
+
task :default => :examples
|
13
13
|
|
14
14
|
def version
|
15
|
-
|
15
|
+
Given::VERSION
|
16
16
|
end
|
17
17
|
|
18
18
|
def tag_name
|
@@ -44,10 +44,10 @@ end
|
|
44
44
|
# Running examples ---------------------------------------------------
|
45
45
|
|
46
46
|
desc "Run all the examples"
|
47
|
-
task :examples => [:specs, :
|
47
|
+
task :examples => [:specs, :rs_examples]
|
48
48
|
|
49
49
|
desc "Run the RSpec 2 specs and examples"
|
50
|
-
task :
|
50
|
+
task :examples => [:specs, :rs_examples, :mt_examples]
|
51
51
|
|
52
52
|
desc "Run the specs"
|
53
53
|
task :specs do
|
@@ -55,28 +55,34 @@ task :specs do
|
|
55
55
|
sh "rspec spec"
|
56
56
|
end
|
57
57
|
|
58
|
-
desc "Run the examples in RSpec 1"
|
59
|
-
task :examples1 => [:verify_rspec1] do
|
60
|
-
puts "Running examples (with RSpec2)"
|
61
|
-
sh "spec examples/stack/stack_spec1.rb"
|
62
|
-
end
|
63
|
-
|
64
58
|
EXAMPLES = FileList['examples/**/*_spec.rb'].
|
65
59
|
exclude('examples/failing/*.rb').
|
66
60
|
exclude('examples/integration/failing/*.rb')
|
67
61
|
|
68
|
-
unless
|
62
|
+
unless Given::NATURAL_ASSERTIONS_SUPPORTED
|
69
63
|
EXAMPLES.exclude("examples/stack/*.rb")
|
70
64
|
end
|
71
65
|
|
72
66
|
FAILING_EXAMPLES = FileList['examples/failing/**/*_spec.rb']
|
73
67
|
|
68
|
+
desc "Run the RSpec specs and examples"
|
69
|
+
task :rs => [:specs, :rs_examples]
|
70
|
+
|
71
|
+
desc "Run the Minitest tests and examples"
|
72
|
+
task :mt => [:specs, :mt_examples]
|
73
|
+
|
74
74
|
desc "Run the examples in RSpec 2"
|
75
|
-
task :
|
75
|
+
task :rs_examples => [:verify_rspec2] do
|
76
76
|
puts "Running examples (with RSpec2)"
|
77
77
|
sh "rspec #{EXAMPLES}"
|
78
78
|
end
|
79
79
|
|
80
|
+
desc "Run the examples in Minitest"
|
81
|
+
task :mt_examples do
|
82
|
+
puts "Running examples (with Minitest)"
|
83
|
+
sh "ruby -Ilib:examples examples/loader.rb #{EXAMPLES}"
|
84
|
+
end
|
85
|
+
|
80
86
|
desc "Run failing examples"
|
81
87
|
task :failing => [:verify_rspec2] do
|
82
88
|
puts "Running failing examples (with RSpec2)"
|
@@ -114,7 +120,7 @@ task :readme => ["README.md"] do
|
|
114
120
|
end
|
115
121
|
|
116
122
|
desc "Generate an RDoc README"
|
117
|
-
file "README.md" => ["examples/stack/stack_spec.rb", "lib/
|
123
|
+
file "README.md" => ["examples/stack/stack_spec.rb", "lib/given/version.rb"] do
|
118
124
|
open("README.md") do |ins|
|
119
125
|
open("README.tmp", "w") do |outs|
|
120
126
|
state = :copy
|
@@ -122,7 +128,7 @@ file "README.md" => ["examples/stack/stack_spec.rb", "lib/rspec/given/version.rb
|
|
122
128
|
case state
|
123
129
|
when :copy
|
124
130
|
if line =~ /rspec-given, version +\d+(\.(\d+|beta))+/i
|
125
|
-
line.gsub!(/version +\d+(\.(\d+|beta))+/i, "version #{
|
131
|
+
line.gsub!(/version +\d+(\.(\d+|beta))+/i, "version #{Given::VERSION}")
|
126
132
|
outs.puts line
|
127
133
|
elsif line =~ /^<pre>/
|
128
134
|
state = :insert
|
@@ -212,7 +218,7 @@ if RDOC_ENABLED
|
|
212
218
|
rdoc.options = [
|
213
219
|
'--line-numbers',
|
214
220
|
'--main' , 'doc/main.rdoc',
|
215
|
-
'--title', '
|
221
|
+
'--title', 'Given - Given/When/Then Extensions for RSpec'
|
216
222
|
]
|
217
223
|
rdoc.options << '-SHN' << '-f' << 'darkfish' if DARKFISH_ENABLED
|
218
224
|
|
data/TODO
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Things to do to improve the minitest integration
|
2
|
+
|
3
|
+
TODO:
|
4
|
+
|
5
|
+
* Make a separate gem for minitest (do we need one for given-core?)
|
6
|
+
|
7
|
+
DONE:
|
8
|
+
|
9
|
+
* Handle have_failed in minitest
|
10
|
+
* General cleanup making sure files go where they need.
|
11
|
+
* Implement assertion counting for minitest
|
12
|
+
* Figure out why the minitest example count is so low.
|
13
|
+
* Move stuff out of minitest_helper to appropriate file.
|
data/examples/example_helper.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rspec/given'
|
2
1
|
require 'example_helper'
|
3
2
|
|
4
3
|
describe "And" do
|
@@ -6,30 +5,26 @@ describe "And" do
|
|
6
5
|
Given(:info) { [] }
|
7
6
|
|
8
7
|
describe "And is called after Then" do
|
9
|
-
Given(:m) { double("mock") }
|
10
|
-
Given { m.should_receive(:and_ran) }
|
11
8
|
Then { info << "T" }
|
12
|
-
And {
|
13
|
-
|
14
|
-
m.and_ran
|
15
|
-
}
|
9
|
+
And { info << "A" }
|
10
|
+
And { given_assert_equal ["T", "A"], info }
|
16
11
|
end
|
17
12
|
|
18
13
|
describe "And is called only once with multiple Thens" do
|
19
14
|
Then { info << "T" }
|
20
15
|
Then { info << "T2" }
|
21
|
-
And { info
|
16
|
+
And { given_assert(info == ["T"] || info == ["T2"]) }
|
22
17
|
end
|
23
18
|
|
24
19
|
describe "Inherited Ands are not run" do
|
25
20
|
Then { info << "T-OUTER" }
|
26
21
|
And { info << "A-OUTER" }
|
27
|
-
And {
|
22
|
+
And { given_assert_equal ["T-OUTER", "A-OUTER"], info }
|
28
23
|
|
29
24
|
context "inner" do
|
30
25
|
Then { info << "T-INNER" }
|
31
26
|
And { info << "A-INNER" }
|
32
|
-
And {
|
27
|
+
And { given_assert_equal ["T-INNER", "A-INNER"], info }
|
33
28
|
end
|
34
29
|
end
|
35
30
|
|
@@ -42,7 +37,7 @@ describe "And" do
|
|
42
37
|
|
43
38
|
it "should define a message" do
|
44
39
|
message = self.class.instance_eval { @message }
|
45
|
-
|
40
|
+
given_assert_match(/and.*without.*then/i, message)
|
46
41
|
end
|
47
42
|
end
|
48
43
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'example_helper'
|
2
2
|
|
3
3
|
describe "Running Givens before Whens" do
|
4
4
|
Given(:info) { [] }
|
@@ -11,11 +11,19 @@ describe "Running Givens before Whens" do
|
|
11
11
|
context "inner with When" do
|
12
12
|
Given { info << "inner1" }
|
13
13
|
Given { info << "inner2" }
|
14
|
-
Then {
|
14
|
+
Then { given_assert_equal ["outer1", "outer2", "inner1", "inner2", "when"], info }
|
15
15
|
|
16
16
|
context "using a nested When" do
|
17
17
|
When { info << "when2" }
|
18
|
-
Then {
|
18
|
+
Then { given_assert_equal ["outer1", "outer2", "inner1", "inner2", "when", "when2"], info}
|
19
|
+
end
|
20
|
+
|
21
|
+
context "using two nested When" do
|
22
|
+
When { info << "when2a" }
|
23
|
+
When { info << "when2b" }
|
24
|
+
Then {
|
25
|
+
given_assert_equal ["outer1", "outer2", "inner1", "inner2", "when", "when2a", "when2b"], info
|
26
|
+
}
|
19
27
|
end
|
20
28
|
end
|
21
29
|
end
|
@@ -26,27 +34,29 @@ describe "Running Givens before Whens" do
|
|
26
34
|
context "inner with when" do
|
27
35
|
Given { info << "inner1" }
|
28
36
|
Given { info << "inner2" }
|
29
|
-
Then {
|
37
|
+
Then { given_assert_equal ["outer1", "outer2", "inner1", "inner2", "when"], info }
|
30
38
|
end
|
31
39
|
end
|
32
40
|
|
33
41
|
context "using no whens" do
|
34
42
|
Given { info << "inner1" }
|
35
43
|
Given { info << "inner2" }
|
36
|
-
Then {
|
44
|
+
Then { given_assert_equal ["outer1", "outer2", "inner1", "inner2"], info }
|
37
45
|
end
|
38
46
|
end
|
39
47
|
|
40
48
|
describe "Lazy Givens" do
|
41
|
-
Given(:bomb) { fail "SHOULD NEVER BE CALLED" }
|
49
|
+
Given(:bomb) { fail StandardError, "SHOULD NEVER BE CALLED" }
|
42
50
|
|
43
51
|
context "when called" do
|
44
|
-
Then {
|
52
|
+
Then {
|
53
|
+
given_assert_raises(StandardError, /NEVER/) { bomb }
|
54
|
+
}
|
45
55
|
end
|
46
56
|
|
47
57
|
context "when not called" do
|
48
58
|
Given(:value) { :ok }
|
49
|
-
Then {
|
59
|
+
Then { given_assert_equal :ok, value }
|
50
60
|
end
|
51
61
|
end
|
52
62
|
|
@@ -57,7 +67,7 @@ describe "Non-Lazy Givens" do
|
|
57
67
|
|
58
68
|
context "inner" do
|
59
69
|
Given!(:a) { info << :given; "A VALUE" }
|
60
|
-
Then {
|
70
|
+
Then { given_assert_equal [:given, :when], info }
|
61
71
|
end
|
62
72
|
|
63
73
|
end
|
@@ -1,23 +1,23 @@
|
|
1
|
-
require '
|
1
|
+
require 'example_helper'
|
2
2
|
|
3
3
|
describe "Invariants" do
|
4
4
|
Given(:info) { [] }
|
5
5
|
|
6
6
|
Invariant { info << "I1" }
|
7
7
|
|
8
|
-
Then {
|
8
|
+
Then { given_assert_equal ["I1"], info }
|
9
9
|
|
10
10
|
context "with nested invariants" do
|
11
11
|
Invariant { info << "I2" }
|
12
12
|
|
13
|
-
Then {
|
13
|
+
Then { given_assert_equal ["I1", "I2"], info }
|
14
14
|
end
|
15
15
|
|
16
16
|
context "with multiple invariants" do
|
17
17
|
Invariant { info << "I2a" }
|
18
18
|
Invariant { info << "I2b" }
|
19
19
|
|
20
|
-
Then {
|
20
|
+
Then { given_assert_equal ["I1", "I2a", "I2b"], info }
|
21
21
|
end
|
22
22
|
|
23
23
|
context "with a when" do
|
@@ -25,7 +25,7 @@ describe "Invariants" do
|
|
25
25
|
|
26
26
|
When(:when_info) { info.dup }
|
27
27
|
|
28
|
-
Then {
|
29
|
-
Then {
|
28
|
+
Then { given_assert_equal ["I1", "I2"], info }
|
29
|
+
Then { given_assert_equal [], when_info }
|
30
30
|
end
|
31
31
|
end
|
data/examples/loader.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
module GivenAssertions
|
3
|
+
def given_assert(cond)
|
4
|
+
assert cond
|
5
|
+
end
|
6
|
+
|
7
|
+
def given_assert_equal(expected, actual)
|
8
|
+
actual.must_equal(expected)
|
9
|
+
end
|
10
|
+
|
11
|
+
def given_assert_match(pattern, actual)
|
12
|
+
actual.must_match(pattern)
|
13
|
+
end
|
14
|
+
|
15
|
+
def given_assert_not_match(pattern, actual)
|
16
|
+
actual.wont_match(pattern)
|
17
|
+
end
|
18
|
+
|
19
|
+
def given_assert_raises(error, pattern=//, &block)
|
20
|
+
ex = assert_raises(error, &block)
|
21
|
+
ex.message.must_match(pattern)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
module NaturalAssertionControl
|
26
|
+
def use_natural_assertions_if_supported(enabled=true)
|
27
|
+
if enabled && ! Given::NATURAL_ASSERTIONS_SUPPORTED
|
28
|
+
Given {
|
29
|
+
skip "Natural assertions are not supported in JRuby"
|
30
|
+
}
|
31
|
+
else
|
32
|
+
use_natural_assertions(enabled)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Minitest::Spec.send(:include, GivenAssertions)
|
38
|
+
include NaturalAssertionControl
|
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'rspec/given'
|
2
1
|
require 'example_helper'
|
3
2
|
require 'stack'
|
4
3
|
|
5
|
-
|
4
|
+
Given.use_natural_assertions
|
6
5
|
|
7
6
|
describe Stack do
|
8
7
|
Given(:stack) { Stack.new }
|
@@ -24,7 +23,7 @@ describe Stack do
|
|
24
23
|
|
25
24
|
context "when popping" do
|
26
25
|
When(:result) { stack.pop }
|
27
|
-
Then { result
|
26
|
+
Then { result == Failure(Stack::UnderflowError, /empty/) }
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
data/lib/given.rb
ADDED
data/lib/rspec/given.rb
CHANGED
@@ -1,19 +1 @@
|
|
1
|
-
|
2
|
-
module Given
|
3
|
-
def self.using_old_rspec?
|
4
|
-
defined?(Spec) &&
|
5
|
-
defined?(Spec::VERSION) &&
|
6
|
-
defined?(Spec::VERSION::SUMMARY) &&
|
7
|
-
Spec::VERSION::SUMMARY =~ /^rspec +1\./
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
if RSpec::Given.using_old_rspec?
|
13
|
-
require 'rspec/given/rspec1_given'
|
14
|
-
else
|
15
|
-
require 'rspec/given/core'
|
16
|
-
require 'rspec/given/have_failed'
|
17
|
-
require 'rspec/given/configure'
|
18
|
-
require 'rspec/given/monkey'
|
19
|
-
end
|
1
|
+
require 'given/rspec/all'
|
@@ -0,0 +1,161 @@
|
|
1
|
+
require 'rubygems/package_task'
|
2
|
+
require './lib/given/version'
|
3
|
+
|
4
|
+
if ! defined?(Gem)
|
5
|
+
puts "Package Target requires RubyGEMs"
|
6
|
+
else
|
7
|
+
PKG_FILES = FileList[
|
8
|
+
'[A-Z]*',
|
9
|
+
'lib/*.rb',
|
10
|
+
'lib/**/*.rb',
|
11
|
+
'rakelib/**/*',
|
12
|
+
'test/**/*.rb',
|
13
|
+
'spec/**/*.rb',
|
14
|
+
'examples/**/*',
|
15
|
+
'doc/**/*',
|
16
|
+
]
|
17
|
+
PKG_FILES.exclude('TAGS')
|
18
|
+
GIVEN_CORE_FILES = FileList[*PKG_FILES].
|
19
|
+
exclude("lib/*-given.rb").
|
20
|
+
exclude("lib/rspec/**/*").
|
21
|
+
exclude("lib/mini*/**/*").
|
22
|
+
exclude("spec/**/*").
|
23
|
+
exclude("examples/**/*")
|
24
|
+
RSPEC_GIVEN_FILES = FileList[*PKG_FILES].
|
25
|
+
exclude("lib/mini*/**/*").
|
26
|
+
exclude("lib/mini*-given.rb").
|
27
|
+
exclude("lib/given/**/*")
|
28
|
+
MINISPEC_GIVEN_FILES = FileList[*PKG_FILES].
|
29
|
+
exclude("spec/**/*").
|
30
|
+
exclude("lib/rspec-given.rb").
|
31
|
+
exclude("lib/rspec*/**/*").
|
32
|
+
exclude("lib/given/**/*")
|
33
|
+
|
34
|
+
RSPEC_GIVEN_SPEC = Gem::Specification.new do |s|
|
35
|
+
s.name = 'rspec-given'
|
36
|
+
s.version = Given::VERSION
|
37
|
+
s.summary = "Given/When/Then Specification Extensions for RSpec."
|
38
|
+
s.description = <<EOF
|
39
|
+
Given is an RSpec extension that allows the use of Given/When/Then
|
40
|
+
terminology when defining specifications.
|
41
|
+
EOF
|
42
|
+
s.files = RSPEC_GIVEN_FILES.to_a
|
43
|
+
s.require_path = 'lib' # Use these for libraries.
|
44
|
+
s.rdoc_options = [
|
45
|
+
'--line-numbers', '--inline-source',
|
46
|
+
'--main' , 'doc/main.rdoc',
|
47
|
+
'--title', 'RSpec Given Extensions'
|
48
|
+
]
|
49
|
+
|
50
|
+
s.add_dependency("given_core", "= #{Given::VERSION}")
|
51
|
+
s.add_dependency("rspec", ">= 2.12")
|
52
|
+
|
53
|
+
s.required_ruby_version = '>= 1.9.2'
|
54
|
+
s.license = "MIT"
|
55
|
+
|
56
|
+
s.author = "Jim Weirich"
|
57
|
+
s.email = "jim.weirich@gmail.com"
|
58
|
+
s.homepage = "http://github.com/jimweirich/rspec-given"
|
59
|
+
s.rubyforge_project = "given"
|
60
|
+
end
|
61
|
+
|
62
|
+
MINISPEC_GIVEN_SPEC = Gem::Specification.new do |s|
|
63
|
+
s.name = 'minispec-given'
|
64
|
+
s.version = Given::VERSION
|
65
|
+
s.summary = "Given/When/Then Specification Extensions for Minispec::Spec."
|
66
|
+
s.description = <<EOF
|
67
|
+
Given is a Minitest::Spec extension that allows the use of Given/When/Then
|
68
|
+
terminology when defining specifications.
|
69
|
+
EOF
|
70
|
+
s.files = MINISPEC_GIVEN_FILES.to_a
|
71
|
+
s.require_path = 'lib' # Use these for libraries.
|
72
|
+
s.rdoc_options = [
|
73
|
+
'--line-numbers', '--inline-source',
|
74
|
+
'--main' , 'doc/main.rdoc',
|
75
|
+
'--title', 'Minitest::Spec Given Extensions'
|
76
|
+
]
|
77
|
+
|
78
|
+
s.add_dependency("given_core", "= #{Given::VERSION}")
|
79
|
+
s.add_dependency("minitest", "> 4.3")
|
80
|
+
|
81
|
+
s.required_ruby_version = '>= 1.9.2'
|
82
|
+
s.license = "MIT"
|
83
|
+
|
84
|
+
s.author = "Jim Weirich"
|
85
|
+
s.email = "jim.weirich@gmail.com"
|
86
|
+
s.homepage = "http://github.com/jimweirich/rspec-given"
|
87
|
+
s.rubyforge_project = "given"
|
88
|
+
end
|
89
|
+
|
90
|
+
GIVEN_CORE_SPEC = Gem::Specification.new do |s|
|
91
|
+
s.name = 'given_core'
|
92
|
+
s.version = Given::VERSION
|
93
|
+
s.summary = "Core engine for RSpec::Given and Minitest::Given."
|
94
|
+
s.description = <<EOF
|
95
|
+
Given_core is the basic functionality behind rspec-given and minispec-given,
|
96
|
+
extensions that allow the use of Given/When/Then terminology when defining
|
97
|
+
specifications.
|
98
|
+
EOF
|
99
|
+
s.files = GIVEN_CORE_FILES.to_a
|
100
|
+
s.require_path = 'lib' # Use these for libraries.
|
101
|
+
s.rdoc_options = [
|
102
|
+
'--line-numbers', '--inline-source',
|
103
|
+
'--main' , 'doc/main.rdoc',
|
104
|
+
'--title', 'RSpec Given Extensions'
|
105
|
+
]
|
106
|
+
|
107
|
+
s.add_dependency("sorcerer", ">= 0.3.7")
|
108
|
+
|
109
|
+
s.required_ruby_version = '>= 1.9.2'
|
110
|
+
s.license = "MIT"
|
111
|
+
|
112
|
+
s.author = "Jim Weirich"
|
113
|
+
s.email = "jim.weirich@gmail.com"
|
114
|
+
s.homepage = "http://github.com/jimweirich/rspec-given"
|
115
|
+
s.rubyforge_project = "given"
|
116
|
+
end
|
117
|
+
|
118
|
+
Gem::PackageTask.new(MINISPEC_GIVEN_SPEC) do |pkg|
|
119
|
+
pkg.need_zip = false
|
120
|
+
pkg.need_tar = false
|
121
|
+
end
|
122
|
+
|
123
|
+
Gem::PackageTask.new(RSPEC_GIVEN_SPEC) do |pkg|
|
124
|
+
pkg.need_zip = false
|
125
|
+
pkg.need_tar = false
|
126
|
+
end
|
127
|
+
|
128
|
+
Gem::PackageTask.new(GIVEN_CORE_SPEC) do |pkg|
|
129
|
+
pkg.need_zip = false
|
130
|
+
pkg.need_tar = false
|
131
|
+
end
|
132
|
+
|
133
|
+
file "rspec-given.gemspec" => ["rakelib/gemspec.rake"] do |t|
|
134
|
+
require 'yaml'
|
135
|
+
open(t.name, "w") { |f| f.puts RSPEC_GIVEN_SPEC.to_yaml }
|
136
|
+
end
|
137
|
+
|
138
|
+
file "minispec-given.gemspec" => ["rakelib/gemspec.rake"] do |t|
|
139
|
+
require 'yaml'
|
140
|
+
open(t.name, "w") { |f| f.puts MINISPEC_GIVEN_SPEC.to_yaml }
|
141
|
+
end
|
142
|
+
|
143
|
+
file "given_core.gemspec" => ["rakelib/gemspec.rake"] do |t|
|
144
|
+
require 'yaml'
|
145
|
+
open(t.name, "w") { |f| f.puts GIVEN_CORE_SPEC.to_yaml }
|
146
|
+
end
|
147
|
+
|
148
|
+
desc "Create a stand-alone gemspec"
|
149
|
+
task :gemspec => ["rspec-given.gemspec", "minispec-given.gemspec", "given_core.gemspec"]
|
150
|
+
|
151
|
+
desc "Check Filelists"
|
152
|
+
task :filelists do
|
153
|
+
puts "==============="
|
154
|
+
puts "GIVEN_CORE_FILES=#{GIVEN_CORE_FILES.inspect}"
|
155
|
+
puts "==============="
|
156
|
+
puts "RSPEC_GIVEN_FILES=#{RSPEC_GIVEN_FILES.inspect}"
|
157
|
+
puts "==============="
|
158
|
+
puts "MINISPEC_GIVEN_FILES=#{MINISPEC_GIVEN_FILES.inspect}"
|
159
|
+
puts "==============="
|
160
|
+
end
|
161
|
+
end
|