rspec-ext 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +7 -0
- data/Rakefile +54 -0
- data/lib/rspec-ext/spec_aspect.rb +27 -0
- data/lib/rspec-ext/specify_negatively.rb +29 -0
- data/lib/rspec-ext/version.rb +9 -0
- data/lib/rspec-ext.rb +2 -0
- data/setup.rb +1585 -0
- metadata +52 -0
data/Manifest.txt
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/packagetask'
|
6
|
+
require 'rake/gempackagetask'
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
require 'rake/contrib/rubyforgepublisher'
|
9
|
+
require 'fileutils'
|
10
|
+
require 'hoe'
|
11
|
+
include FileUtils
|
12
|
+
require File.join(File.dirname(__FILE__), 'lib', 'rspec-ext', 'version')
|
13
|
+
|
14
|
+
AUTHOR = "Yurii A. Rashkovskii"
|
15
|
+
EMAIL = "yrashk@verbdev.com"
|
16
|
+
DESCRIPTION = "RSpec Extensions"
|
17
|
+
GEM_NAME = "rspec-ext"
|
18
|
+
RUBYFORGE_PROJECT = "rspec-ext" # The unix name for your project
|
19
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
20
|
+
|
21
|
+
|
22
|
+
NAME = "rspec-ext"
|
23
|
+
REV = nil # UNCOMMENT IF REQUIRED: File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
24
|
+
VERS = ENV['VERSION'] || (RspecExt::VERSION::STRING + (REV ? ".#{REV}" : ""))
|
25
|
+
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
26
|
+
RDOC_OPTS = ['--quiet', '--title', "rspec-ext documentation",
|
27
|
+
"--opname", "index.html",
|
28
|
+
"--line-numbers",
|
29
|
+
"--main", "README",
|
30
|
+
"--inline-source"]
|
31
|
+
|
32
|
+
class Hoe
|
33
|
+
def extra_deps
|
34
|
+
@extra_deps.reject { |x| Array(x).first == 'hoe' }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Generate all the Rake tasks
|
39
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
40
|
+
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
41
|
+
p.author = AUTHOR
|
42
|
+
p.description = DESCRIPTION
|
43
|
+
p.email = EMAIL
|
44
|
+
p.summary = DESCRIPTION
|
45
|
+
p.url = HOMEPATH
|
46
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
47
|
+
p.test_globs = ["test/**/*_test.rb"]
|
48
|
+
p.clean_globs = CLEAN #An array of file patterns to delete on clean.
|
49
|
+
p.spec_extras = { :autorequire => 'rspec-ext' }
|
50
|
+
# == Optional
|
51
|
+
#p.changes - A description of the release's latest changes.
|
52
|
+
#p.extra_deps - An array of rubygem dependencies.
|
53
|
+
#p.spec_extras - A hash of extra values to set in the gemspec.
|
54
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Spec ; module Runner
|
2
|
+
|
3
|
+
class Specification
|
4
|
+
@@aspect = []
|
5
|
+
def self.aspect
|
6
|
+
@@aspect
|
7
|
+
end
|
8
|
+
def self.aspect=(new_aspect)
|
9
|
+
@@aspect = new_aspect
|
10
|
+
end
|
11
|
+
alias :original_initialize :initialize
|
12
|
+
def initialize(*args,&context_block)
|
13
|
+
result = original_initialize(*args, &context_block)
|
14
|
+
@name = "(#{self.class.aspect.join("/")}) #{@name}" unless self.class.aspect.empty?
|
15
|
+
result
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module ContextEval ; module ModuleMethods
|
20
|
+
def aspect(name,&block)
|
21
|
+
Specification.aspect << name.to_s
|
22
|
+
yield
|
23
|
+
Specification.aspect.pop
|
24
|
+
end
|
25
|
+
end ; end
|
26
|
+
|
27
|
+
end ; end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Spec ; module Runner
|
2
|
+
|
3
|
+
class Context
|
4
|
+
|
5
|
+
def specify_negatively(spec_name, opts={}, &block)
|
6
|
+
@context_eval_module.specify_negatively(spec_name, opts, &block)
|
7
|
+
end
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class NegativeSpecification < Specification
|
12
|
+
private
|
13
|
+
def execute_spec(execution_context, errors)
|
14
|
+
execution_context.instance_eval(&command)
|
15
|
+
errors << Spec::Expectations::ExpectationNotMetError.new("This specification was expected to fail, but nothing failed")
|
16
|
+
return false
|
17
|
+
rescue => e
|
18
|
+
return true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module ContextEval ; module ModuleMethods
|
23
|
+
def specify_negatively(spec_name, opts={}, &block)
|
24
|
+
options = opts.reverse_merge(:reason=>"NOT YET IMPLEMENTED")
|
25
|
+
specifications << NegativeSpecification.new("NEGATIVE: #{spec_name} (#{options[:reason]})", options, &block)
|
26
|
+
end
|
27
|
+
end ; end
|
28
|
+
|
29
|
+
end ; end
|
data/lib/rspec-ext.rb
ADDED