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.
@@ -5,3 +5,4 @@ lib/rspec-ext/version.rb
5
5
  lib/rspec-ext.rb
6
6
  lib/rspec-ext/spec_aspect.rb
7
7
  lib/rspec-ext/specify_negatively.rb
8
+ spec/specify_negatively_spec.rb
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
+
@@ -1,2 +1,2 @@
1
- require_gem 'rspec'
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(&command)
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 = opts.reverse_merge(:reason=>"NOT YET IMPLEMENTED")
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
@@ -1,8 +1,8 @@
1
1
  module RspecExt #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 0
5
- TINY = 1
4
+ MINOR = 1
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -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.0
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.1
7
- date: 2007-02-15 00:00:00 +02:00
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: []