rspec-ext 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest.txt +1 -0
- data/Rakefile +8 -1
- data/lib/rspec-ext.rb +1 -1
- data/lib/rspec-ext/specify_negatively.rb +3 -2
- data/lib/rspec-ext/version.rb +2 -2
- data/spec/specify_negatively_spec.rb +53 -0
- metadata +4 -3
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
require 'rake/clean'
|
4
|
-
require 'rake/testtask'
|
5
4
|
require 'rake/packagetask'
|
6
5
|
require 'rake/gempackagetask'
|
7
6
|
require 'rake/rdoctask'
|
8
7
|
require 'rake/contrib/rubyforgepublisher'
|
8
|
+
require 'spec/rake/spectask'
|
9
9
|
require 'fileutils'
|
10
10
|
require 'hoe'
|
11
11
|
include FileUtils
|
@@ -52,3 +52,10 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
52
52
|
#p.extra_deps - An array of rubygem dependencies.
|
53
53
|
#p.spec_extras - A hash of extra values to set in the gemspec.
|
54
54
|
end
|
55
|
+
|
56
|
+
desc "Run all specifications"
|
57
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
58
|
+
t.spec_files = FileList['spec/*.rb']
|
59
|
+
end
|
60
|
+
|
61
|
+
|
data/lib/rspec-ext.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
gem 'rspec', '>=0.8.0'
|
2
2
|
Dir[File.join(File.dirname(__FILE__), 'rspec-ext/**/*.rb')].sort.each { |lib| require lib }
|
@@ -11,7 +11,7 @@ module Spec ; module Runner
|
|
11
11
|
class NegativeSpecification < Specification
|
12
12
|
private
|
13
13
|
def execute_spec(execution_context, errors)
|
14
|
-
execution_context.instance_eval(&
|
14
|
+
execution_context.instance_eval(&spec_block)
|
15
15
|
errors << Spec::Expectations::ExpectationNotMetError.new("This specification was expected to fail, but nothing failed")
|
16
16
|
return false
|
17
17
|
rescue => e
|
@@ -21,7 +21,8 @@ module Spec ; module Runner
|
|
21
21
|
|
22
22
|
module ContextEval ; module ModuleMethods
|
23
23
|
def specify_negatively(spec_name, opts={}, &block)
|
24
|
-
options =
|
24
|
+
options = { :reason=>"NOT YET IMPLEMENTED" }
|
25
|
+
options = opts.merge(options)
|
25
26
|
specifications << NegativeSpecification.new("NEGATIVE: #{spec_name} (#{options[:reason]})", options, &block)
|
26
27
|
end
|
27
28
|
end ; end
|
data/lib/rspec-ext/version.rb
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'rubygems'
|
3
|
+
require File.dirname(__FILE__) + '/../lib/rspec-ext'
|
4
|
+
|
5
|
+
context "Context" do
|
6
|
+
|
7
|
+
specify "should fail if everything works fine" do
|
8
|
+
code = "
|
9
|
+
specify_negatively 'should fail if everything works fine' do
|
10
|
+
1.should == 1
|
11
|
+
end
|
12
|
+
"
|
13
|
+
write_spec(code)
|
14
|
+
run_spec.should == false
|
15
|
+
end
|
16
|
+
|
17
|
+
specify "should not fail if something is failing" do
|
18
|
+
code = "
|
19
|
+
specify_negatively 'should not fail if something is failing' do
|
20
|
+
1.should == 2
|
21
|
+
end
|
22
|
+
"
|
23
|
+
write_spec(code)
|
24
|
+
run_spec.should == true
|
25
|
+
end
|
26
|
+
|
27
|
+
setup do
|
28
|
+
FileUtils::rm_f "test_spec.rb"
|
29
|
+
end
|
30
|
+
|
31
|
+
teardown do
|
32
|
+
FileUtils::rm_f "test_spec.rb"
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def write_spec(code,name="test_spec.rb")
|
38
|
+
File.open(name,"w") do |f|
|
39
|
+
f.write "
|
40
|
+
require 'rubygems'
|
41
|
+
require_gem 'rspec'
|
42
|
+
require File.dirname(__FILE__) + '/lib/rspec-ext'
|
43
|
+
context 'test context' do
|
44
|
+
"
|
45
|
+
f.write code
|
46
|
+
f.write "\nend\n"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def run_spec(name="test_spec.rb")
|
51
|
+
system "spec -f s #{name} >/dev/null 1>/dev/null 2>/dev/null"
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: rspec-ext
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0
|
7
|
-
date: 2007-02-
|
6
|
+
version: 0.1.0
|
7
|
+
date: 2007-02-26 00:00:00 +02:00
|
8
8
|
summary: RSpec Extensions
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- lib/rspec-ext.rb
|
37
37
|
- lib/rspec-ext/spec_aspect.rb
|
38
38
|
- lib/rspec-ext/specify_negatively.rb
|
39
|
+
- spec/specify_negatively_spec.rb
|
39
40
|
test_files: []
|
40
41
|
|
41
42
|
rdoc_options: []
|