You are viewing a plain text version of this content. The canonical link for it is here.
Posted to olio-commits@incubator.apache.org by ws...@apache.org on 2008/12/11 01:34:30 UTC
svn commit: r725524 [9/14] - in /incubator/olio/webapp/rails/trunk:
app/controllers/ app/models/ app/views/events/ config/ config/environments/
spec/controllers/ spec/models/ vendor/plugins/attachment_fu/
vendor/plugins/attachment_fu/lib/ vendor/plugin...
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/option_parser.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/option_parser.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/option_parser.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/option_parser.rb Wed Dec 10 17:34:18 2008
@@ -4,12 +4,10 @@
module Spec
module Runner
class OptionParser < ::OptionParser
- class << self
- def parse(args, err, out)
- parser = new(err, out)
- parser.parse(args)
- parser.options
- end
+ def self.parse(args, err, out)
+ parser = new(err, out)
+ parser.parse(args)
+ parser.options
end
attr_reader :options
@@ -34,26 +32,27 @@
"an example name directly, causing RSpec to run just the example",
"matching that name"],
:specification => ["-s", "--specification [NAME]", "DEPRECATED - use -e instead", "(This will be removed when autotest works with -e)"],
- :line => ["-l", "--line LINE_NUMBER", Integer, "Execute behaviout or specification at given line.",
- "(does not work for dynamically generated specs)"],
+ :line => ["-l", "--line LINE_NUMBER", Integer, "Execute example group or example at given line.",
+ "(does not work for dynamically generated examples)"],
:format => ["-f", "--format FORMAT[:WHERE]","Specifies what format to use for output. Specify WHERE to tell",
"the formatter where to write the output. All built-in formats",
- "expect WHERE to be a file name, and will write to STDOUT if it's",
+ "expect WHERE to be a file name, and will write to $stdout if it's",
"not specified. The --format option may be specified several times",
"if you want several outputs",
" ",
- "Builtin formats for examples: ",
- "progress|p : Text progress",
- "profile|o : Text progress with profiling of 10 slowest examples",
- "specdoc|s : Example doc as text",
- "indented|i : Example doc as indented text",
+ "Builtin formats for code examples:",
+ "progress|p : Text-based progress bar",
+ "profile|o : Text-based progress bar with profiling of 10 slowest examples",
+ "specdoc|s : Code example doc strings",
+ "nested|n : Code example doc strings with nested groups intented",
"html|h : A nice HTML report",
"failing_examples|e : Write all failing examples - input for --example",
"failing_example_groups|g : Write all failing example groups - input for --example",
" ",
- "Builtin formats for stories: ",
- "plain|p : Plain Text",
- "html|h : A nice HTML report",
+ "Builtin formats for stories:",
+ "plain|p : Plain Text",
+ "html|h : A nice HTML report",
+ "progress|r : Text progress",
" ",
"FORMAT can also be the name of a custom formatter class",
"(in which case you should also specify --require to load it)"],
@@ -93,30 +92,31 @@
self.banner = "Usage: spec (FILE|DIRECTORY|GLOB)+ [options]"
self.separator ""
- on(*OPTIONS[:pattern]) {|pattern| @options.filename_pattern = pattern}
- on(*OPTIONS[:diff]) {|diff| @options.parse_diff(diff)}
- on(*OPTIONS[:colour]) {@options.colour = true}
- on(*OPTIONS[:example]) {|example| @options.parse_example(example)}
- on(*OPTIONS[:specification]) {|example| @options.parse_example(example)}
- on(*OPTIONS[:line]) {|line_number| @options.line_number = line_number.to_i}
- on(*OPTIONS[:format]) {|format| @options.parse_format(format)}
- on(*OPTIONS[:require]) {|requires| invoke_requires(requires)}
- on(*OPTIONS[:backtrace]) {@options.backtrace_tweaker = NoisyBacktraceTweaker.new}
- on(*OPTIONS[:loadby]) {|loadby| @options.loadby = loadby}
- on(*OPTIONS[:reverse]) {@options.reverse = true}
- on(*OPTIONS[:timeout]) {|timeout| @options.timeout = timeout.to_f}
- on(*OPTIONS[:heckle]) {|heckle| @options.load_heckle_runner(heckle)}
- on(*OPTIONS[:dry_run]) {@options.dry_run = true}
- on(*OPTIONS[:options_file]) {|options_file| parse_options_file(options_file)}
+ on(*OPTIONS[:pattern]) {|pattern| @options.filename_pattern = pattern}
+ on(*OPTIONS[:diff]) {|diff| @options.parse_diff(diff)}
+ on(*OPTIONS[:colour]) {@options.colour = true}
+ on(*OPTIONS[:example]) {|example| @options.parse_example(example)}
+ on(*OPTIONS[:specification]) {|example| @options.parse_example(example)}
+ on(*OPTIONS[:line]) {|line_number| @options.line_number = line_number.to_i}
+ on(*OPTIONS[:format]) {|format| @options.parse_format(format)}
+ on(*OPTIONS[:require]) {|requires| invoke_requires(requires)}
+ on(*OPTIONS[:backtrace]) {@options.backtrace_tweaker = NoisyBacktraceTweaker.new}
+ on(*OPTIONS[:loadby]) {|loadby| @options.loadby = loadby}
+ on(*OPTIONS[:reverse]) {@options.reverse = true}
+ on(*OPTIONS[:timeout]) {|timeout| @options.timeout = timeout.to_f}
+ on(*OPTIONS[:heckle]) {|heckle| @options.load_heckle_runner(heckle)}
+ on(*OPTIONS[:dry_run]) {@options.dry_run = true}
+ on(*OPTIONS[:options_file]) {|options_file| parse_options_file(options_file)}
on(*OPTIONS[:generate_options]) {|options_file|}
- on(*OPTIONS[:runner]) {|runner| @options.user_input_for_runner = runner}
- on(*OPTIONS[:drb]) {}
- on(*OPTIONS[:version]) {parse_version}
- on_tail(*OPTIONS[:help]) {parse_help}
+ on(*OPTIONS[:runner]) {|runner| @options.user_input_for_runner = runner}
+ on(*OPTIONS[:drb]) {}
+ on(*OPTIONS[:version]) {parse_version}
+ on_tail(*OPTIONS[:help]) {parse_help}
end
def order!(argv, &blk)
- @argv = argv
+ @argv = argv.dup
+ @argv = (@argv.empty? && Spec.spec_command?) ? ['--help'] : @argv
@options.argv = @argv.dup
return if parse_generate_options
return if parse_drb
@@ -128,7 +128,7 @@
@options
end
-
+
protected
def invoke_requires(requires)
requires.split(",").each do |file|
@@ -186,7 +186,7 @@
end
def parse_version
- @out_stream.puts ::Spec::VERSION::DESCRIPTION
+ @out_stream.puts ::Spec::VERSION::SUMMARY
exit if stdout?
end
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/options.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/options.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/options.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/options.rb Wed Dec 10 17:34:18 2008
@@ -8,7 +8,7 @@
EXAMPLE_FORMATTERS = { # Load these lazily for better speed
'specdoc' => ['spec/runner/formatter/specdoc_formatter', 'Formatter::SpecdocFormatter'],
's' => ['spec/runner/formatter/specdoc_formatter', 'Formatter::SpecdocFormatter'],
- 'nested' => ['spec/runner/formatter/nested_text_formatter', 'Formatter::NestedTextFormatter'],
+ 'nested' => ['spec/runner/formatter/nested_text_formatter', 'Formatter::NestedTextFormatter'],
'n' => ['spec/runner/formatter/nested_text_formatter', 'Formatter::NestedTextFormatter'],
'html' => ['spec/runner/formatter/html_formatter', 'Formatter::HtmlFormatter'],
'h' => ['spec/runner/formatter/html_formatter', 'Formatter::HtmlFormatter'],
@@ -24,10 +24,13 @@
}
STORY_FORMATTERS = {
- 'plain' => ['spec/runner/formatter/story/plain_text_formatter', 'Formatter::Story::PlainTextFormatter'],
- 'p' => ['spec/runner/formatter/story/plain_text_formatter', 'Formatter::Story::PlainTextFormatter'],
- 'html' => ['spec/runner/formatter/story/html_formatter', 'Formatter::Story::HtmlFormatter'],
- 'h' => ['spec/runner/formatter/story/html_formatter', 'Formatter::Story::HtmlFormatter']
+ 'plain' => ['spec/runner/formatter/story/plain_text_formatter', 'Formatter::Story::PlainTextFormatter'],
+ 'p' => ['spec/runner/formatter/story/plain_text_formatter', 'Formatter::Story::PlainTextFormatter'],
+ 'html' => ['spec/runner/formatter/story/html_formatter', 'Formatter::Story::HtmlFormatter'],
+ 'h' => ['spec/runner/formatter/story/html_formatter', 'Formatter::Story::HtmlFormatter'],
+ 'progress' => ['spec/runner/formatter/story/progress_bar_formatter', 'Formatter::Story::ProgressBarFormatter'],
+ 'r' => ['spec/runner/formatter/story/progress_bar_formatter', 'Formatter::Story::ProgressBarFormatter']
+
}
attr_accessor(
@@ -54,7 +57,7 @@
:argv
)
attr_reader :colour, :differ_class, :files, :example_groups
-
+
def initialize(error_stream, output_stream)
@error_stream = error_stream
@output_stream = output_stream
@@ -89,9 +92,6 @@
return true unless examples_should_be_run?
success = true
begin
- before_suite_parts.each do |part|
- part.call
- end
runner = custom_runner || ExampleGroupRunner.new(self)
unless @files_loaded
@@ -99,6 +99,15 @@
@files_loaded = true
end
+ # TODO - this has to happen after the files get loaded,
+ # otherwise the before_suite_parts are not populated
+ # from the configuration. There is no spec for this
+ # directly, but stories/configuration/before_blocks.story
+ # will fail if this happens before the files are loaded.
+ before_suite_parts.each do |part|
+ part.call
+ end
+
if example_groups.empty?
true
else
@@ -125,10 +134,12 @@
def colour=(colour)
@colour = colour
- if @colour && RUBY_PLATFORM =~ /win32/ ;\
+ if @colour && RUBY_PLATFORM =~ /mswin|mingw/ ;\
begin ;\
+ replace_output = @output_stream.equal?($stdout) ;\
require 'rubygems' ;\
require 'Win32/Console/ANSI' ;\
+ @output_stream = $stdout if replace_output ;\
rescue LoadError ;\
warn "You must 'gem install win32console' to use colour on Windows" ;\
@colour = false ;\
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/reporter.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/reporter.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/reporter.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/reporter.rb Wed Dec 10 17:34:18 2008
@@ -26,7 +26,7 @@
if error.nil?
example_passed(example)
elsif Spec::Example::ExamplePendingError === error
- example_pending(example, error.message)
+ example_pending(example, error.pending_caller, error.message)
else
example_failed(example, error)
end
@@ -103,14 +103,34 @@
def example_passed(example)
formatters.each{|f| f.example_passed(example)}
end
+
+ EXAMPLE_PENDING_DEPRECATION_WARNING = <<-WARNING
+ DEPRECATION NOTICE: RSpec's formatters have changed example_pending
+ to accept three arguments instead of just two. Please see the rdoc
+ for Spec::Runner::Formatter::BaseFormatter#example_pending
+ for more information.
+
+ Please update any custom formatters to accept the third argument
+ to example_pending. Support for example_pending with two arguments
+ and this warning message will be removed after the RSpec 1.1.5 release.
+ WARNING
- def example_pending(example, message="Not Yet Implemented")
+ def example_pending(example, pending_caller, message="Not Yet Implemented")
@pending_count += 1
- formatters.each do |f|
- f.example_pending(example, message)
+ formatters.each do |formatter|
+ if formatter_uses_deprecated_example_pending_method?(formatter)
+ Kernel.warn EXAMPLE_PENDING_DEPRECATION_WARNING
+ formatter.example_pending(example, message)
+ else
+ formatter.example_pending(example, message, pending_caller)
+ end
end
end
+ def formatter_uses_deprecated_example_pending_method?(formatter)
+ formatter.method(:example_pending).arity == 2
+ end
+
class Failure
attr_reader :example, :exception
@@ -139,7 +159,7 @@
protected
def example_name
- @example.__full_description
+ @example.full_description
end
end
end
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/spec_parser.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/spec_parser.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/spec_parser.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/runner/spec_parser.rb Wed Dec 10 17:34:18 2008
@@ -11,8 +11,8 @@
def spec_name_for(file, line_number)
best_match.clear
file = File.expand_path(file)
- rspec_options.example_groups.each do |example_group|
- consider_example_groups_for_best_match example_group, file, line_number
+ Spec::Runner.options.example_groups.each do |example_group|
+ consider_example_group_for_best_match example_group, file, line_number
example_group.examples.each do |example|
consider_example_for_best_match example, example_group, file, line_number
@@ -31,8 +31,8 @@
protected
- def consider_example_groups_for_best_match(example_group, file, line_number)
- parsed_backtrace = parse_backtrace(example_group.registration_backtrace)
+ def consider_example_group_for_best_match(example_group, file, line_number)
+ parsed_backtrace = parse_backtrace(example_group.backtrace)
parsed_backtrace.each do |example_file, example_line|
if is_best_match?(file, line_number, example_file, example_line)
best_match.clear
@@ -43,7 +43,7 @@
end
def consider_example_for_best_match(example, example_group, file, line_number)
- parsed_backtrace = parse_backtrace(example.implementation_backtrace)
+ parsed_backtrace = parse_backtrace(example.backtrace)
parsed_backtrace.each do |example_file, example_line|
if is_best_match?(file, line_number, example_file, example_line)
best_match.clear
@@ -61,9 +61,10 @@
end
def parse_backtrace(backtrace)
- backtrace.collect do |trace_line|
- split_line = trace_line.split(':')
- [split_line[0], Integer(split_line[1])]
+ Array(backtrace).collect do |trace_line|
+ trace_line =~ /(.*)\:(\d*)(\:|$)/
+ file, number = $1, $2
+ [file, Integer(number)]
end
end
end
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/runner.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/runner.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/runner.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/runner.rb Wed Dec 10 17:34:18 2008
@@ -8,53 +8,50 @@
module Spec
module Story
module Runner
- class << self
- def run_options # :nodoc:
- rspec_options
- # @run_options ||= ::Spec::Runner::OptionParser.parse(ARGV, $stderr, $stdout)
- end
-
- def story_runner # :nodoc:
- unless @story_runner
- @story_runner = create_story_runner
- run_options.story_formatters.each do |formatter|
- register_listener(formatter)
- end
- self.register_exit_hook
- end
- @story_runner
- end
-
- def scenario_runner # :nodoc:
- @scenario_runner ||= ScenarioRunner.new
- end
-
- def world_creator # :nodoc:
- @world_creator ||= World
- end
-
- def create_story_runner
- StoryRunner.new(scenario_runner, world_creator)
- end
-
- # Use this to register a customer output formatter.
- def register_listener(listener)
- story_runner.add_listener(listener) # run_started, story_started, story_ended, #run_ended
- world_creator.add_listener(listener) # found_scenario, step_succeeded, step_failed, step_failed
- scenario_runner.add_listener(listener) # scenario_started, scenario_succeeded, scenario_pending, scenario_failed
- end
-
- def register_exit_hook # :nodoc:
- at_exit do
- exit Runner.story_runner.run_stories unless $!
+ def self.run_options # :nodoc:
+ Spec::Runner.options
+ end
+
+ def self.story_runner # :nodoc:
+ unless @story_runner
+ @story_runner = create_story_runner
+ run_options.story_formatters.each do |formatter|
+ register_listener(formatter)
end
+ self.register_exit_hook
end
-
- def dry_run
- run_options.dry_run
+ @story_runner
+ end
+
+ def self.scenario_runner # :nodoc:
+ @scenario_runner ||= ScenarioRunner.new
+ end
+
+ def self.world_creator # :nodoc:
+ @world_creator ||= World
+ end
+
+ def self.create_story_runner
+ Runner::StoryRunner.new(scenario_runner, world_creator)
+ end
+
+ # Use this to register a customer output formatter.
+ def self.register_listener(listener)
+ story_runner.add_listener(listener) # run_started, story_started, story_ended, #run_ended
+ world_creator.add_listener(listener) # found_scenario, step_succeeded, step_failed, step_failed
+ scenario_runner.add_listener(listener) # scenario_started, scenario_succeeded, scenario_pending, scenario_failed
+ end
+
+ def self.register_exit_hook # :nodoc:
+ at_exit do
+ exit Runner.story_runner.run_stories unless $!
end
-
end
+
+ def self.dry_run
+ run_options.dry_run
+ end
+
end
end
end
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb Wed Dec 10 17:34:18 2008
@@ -2,12 +2,16 @@
module Story
module Runner
class StoryRunner
- class << self
- attr_accessor :current_story_runner
-
- def scenario_from_current_story(scenario_name)
- current_story_runner.scenario_from_current_story(scenario_name)
- end
+ def self.current_story_runner
+ @current_story_runner
+ end
+
+ def self.current_story_runner=(current_story_runner)
+ @current_story_runner = current_story_runner
+ end
+
+ def self.scenario_from_current_story(scenario_name)
+ current_story_runner.scenario_from_current_story(scenario_name)
end
attr_accessor :stories, :scenarios, :current_story
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/step.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/step.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/step.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/step.rb Wed Dec 10 17:34:18 2008
@@ -19,11 +19,11 @@
end
def matches?(name)
- !(matches = name.match(@expression)).nil?
+ !(name.strip =~ @expression).nil?
end
def parse_args(name)
- name.match(@expression)[1..-1]
+ name.strip.match(@expression)[1..-1]
end
private
@@ -60,7 +60,7 @@
expression = string_or_regexp.source
end
while expression =~ PARAM_PATTERN
- expression.gsub!($2, "(.*?)")
+ expression.sub!($2, "(.*?)")
end
@expression = Regexp.new("\\A#{expression}\\Z", Regexp::MULTILINE)
end
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/step_mother.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/step_mother.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/step_mother.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/step_mother.rb Wed Dec 10 17:34:18 2008
@@ -13,7 +13,8 @@
@steps.add(type, step)
end
- def find(type, name)
+ def find(type, unstripped_name)
+ name = unstripped_name.strip
if @steps.find(type, name).nil?
@steps.add(type,
Step.new(name) do
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/world.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/world.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/world.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/story/world.rb Wed Dec 10 17:34:18 2008
@@ -15,82 +15,78 @@
module World
include ::Spec::Example::Pending
include ::Spec::Matchers
- # store steps and listeners in the singleton metaclass.
- # This serves both to keep them out of the way of runtime Worlds
- # and to make them available to all instances.
- class << self
- def create(cls = Object, *args)
- cls.new(*args).extend(World)
- end
-
- def listeners
- @listeners ||= []
- end
-
- def add_listener(listener)
- listeners() << listener
- end
-
- def step_mother
- @step_mother ||= StepMother.new
- end
-
- def use(steps)
- step_mother.use(steps)
- end
-
- def step_names
- @step_names ||= []
- end
- def run_given_scenario_with_suspended_listeners(world, type, name, scenario)
- current_listeners = Array.new(listeners)
- begin
- listeners.each { |l| l.found_scenario(type, name) }
- @listeners.clear
- scenario.perform(world, name) unless dry_run
- ensure
- @listeners.replace(current_listeners)
- end
- end
-
- def store_and_call(world, type, name, *args, &block)
- if block_given?
- step_mother.store(type, Step.new(name, &block))
- end
- step = step_mother.find(type, name)
+ def self.create(cls = Object, *args)
+ cls.new(*args).extend(World)
+ end
+
+ def self.listeners
+ @listeners ||= []
+ end
+
+ def self.add_listener(listener)
+ listeners() << listener
+ end
+
+ def self.step_mother
+ @step_mother ||= StepMother.new
+ end
+
+ def self.use(steps)
+ step_mother.use(steps)
+ end
+
+ def self.step_names
+ @step_names ||= []
+ end
- step_name = step.name
- step_names << step_name
-
- # It's important to have access to the parsed args here, so
- # we can give them to the listeners. The HTML reporter needs
- # the args so it can style them. See the generated output in
- # story_server/prototype/rspec_stories.html (generated by rake stories)
- args = step.parse_args(name) if args.empty?
- begin
- listeners.each { |l| l.step_upcoming(type, step_name, *args) }
- step.perform(world, *args) unless dry_run
- listeners.each { |l| l.step_succeeded(type, step_name, *args) }
- rescue Exception => e
- case e
- when Spec::Example::ExamplePendingError
- @listeners.each { |l| l.step_pending(type, step_name, *args) }
- else
- @listeners.each { |l| l.step_failed(type, step_name, *args) }
- end
- errors << e
- end
+ def self.run_given_scenario_with_suspended_listeners(world, type, name, scenario)
+ current_listeners = Array.new(listeners)
+ begin
+ listeners.each { |l| l.found_scenario(type, name) }
+ @listeners.clear
+ scenario.perform(world, name) unless dry_run
+ ensure
+ @listeners.replace(current_listeners)
end
-
- def errors
- @errors ||= []
+ end
+
+ def self.store_and_call(world, type, name, *args, &block)
+ if block_given?
+ step_mother.store(type, Step.new(name, &block))
end
+ step = step_mother.find(type, name)
+
+ step_name = step.name
+ step_names << step_name
- def dry_run
- ::Spec::Story::Runner.dry_run
+ # It's important to have access to the parsed args here, so
+ # we can give them to the listeners. The HTML reporter needs
+ # the args so it can style them. See the generated output in
+ # story_server/prototype/rspec_stories.html (generated by rake stories)
+ args = step.parse_args(name) if args.empty?
+ begin
+ listeners.each { |l| l.step_upcoming(type, step_name, *args) }
+ step.perform(world, *args) unless dry_run
+ listeners.each { |l| l.step_succeeded(type, step_name, *args) }
+ rescue Exception => e
+ case e
+ when Spec::Example::ExamplePendingError
+ @listeners.each { |l| l.step_pending(type, step_name, *args) }
+ else
+ @listeners.each { |l| l.step_failed(type, step_name, *args) }
+ end
+ errors << e
end
- end # end of class << self
+ end
+
+ def self.errors
+ @errors ||= []
+ end
+
+ def self.dry_run
+ ::Spec::Story::Runner.dry_run
+ end
def start_collecting_errors
errors.clear
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/version.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/version.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/version.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/lib/spec/version.rb Wed Dec 10 17:34:18 2008
@@ -1,22 +1,15 @@
-module Spec
- module VERSION
- unless defined? MAJOR
- MAJOR = 1
- MINOR = 1
- TINY = 4
- RELEASE_CANDIDATE = nil
-
- BUILD_TIME_UTC = 20080615141040
-
- STRING = [MAJOR, MINOR, TINY].join('.')
- TAG = "REL_#{[MAJOR, MINOR, TINY, RELEASE_CANDIDATE].compact.join('_')}".upcase.gsub(/\.|-/, '_')
- FULL_VERSION = "#{[MAJOR, MINOR, TINY, RELEASE_CANDIDATE].compact.join('.')} (build #{BUILD_TIME_UTC})"
-
- NAME = "RSpec"
- URL = "http://rspec.rubyforge.org/"
-
- DESCRIPTION = "#{NAME}-#{FULL_VERSION} - BDD for Ruby\n#{URL}"
- end
- end
-end
-
+module Spec
+ module VERSION
+ unless defined? MAJOR
+ MAJOR = 1
+ MINOR = 1
+ TINY = 11
+ MINESCULE = 1
+
+
+ STRING = [MAJOR, MINOR, TINY, MINESCULE].join('.')
+
+ SUMMARY = "rspec #{STRING}"
+ end
+ end
+end
\ No newline at end of file
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rake_tasks/failing_examples_with_html.rake
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rake_tasks/failing_examples_with_html.rake?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rake_tasks/failing_examples_with_html.rake (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rake_tasks/failing_examples_with_html.rake Wed Dec 10 17:34:18 2008
@@ -4,6 +4,6 @@
desc "Generate HTML report for failing examples"
Spec::Rake::SpecTask.new('failing_examples_with_html') do |t|
t.spec_files = FileList['failing_examples/**/*.rb']
- t.spec_opts = ["--format", "html:../doc/output/documentation/tools/failing_examples.html", "--diff"]
+ t.spec_opts = ["--format", "html:doc/reports/tools/failing_examples.html", "--diff"]
t.fail_on_error = false
end
\ No newline at end of file
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rake_tasks/verify_rcov.rake
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rake_tasks/verify_rcov.rake?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rake_tasks/verify_rcov.rake (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rake_tasks/verify_rcov.rake Wed Dec 10 17:34:18 2008
@@ -2,6 +2,6 @@
require 'spec/rake/verify_rcov'
RCov::VerifyTask.new(:verify_rcov => :spec) do |t|
- t.threshold = 100.0 # Make sure you have rcov 0.7 or higher!
- t.index_html = '../doc/output/coverage/index.html'
+ t.threshold = 100.0
+ t.index_html = 'coverage/index.html'
end
Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rspec.gemspec
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rspec.gemspec?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rspec.gemspec (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/rspec.gemspec Wed Dec 10 17:34:18 2008
@@ -0,0 +1,31 @@
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{rspec}
+ s.version = "1.1.11.1"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["RSpec Development Team"]
+ s.date = %q{2008-11-24}
+ s.description = %q{Behaviour Driven Development for Ruby.}
+ s.email = ["rspec-devel@rubyforge.org"]
+ s.executables = ["autospec", "spec"]
+ s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "TODO.txt", "examples/failing/README.txt", "examples/passing/priority.txt", "spec/spec/runner/empty_file.txt", "spec/spec/runner/examples.txt", "spec/spec/runner/failed.txt"]
+ s.files = [".autotest", "History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "TODO.txt", "bin/autospec", "bin/spec", "examples/failing/README.txt", "examples/failing/diffing_spec.rb", "examples/failing/failing_autogenerated_docstrings_example.rb", "examples/failing/failure_in_setup.rb", "examples/failing/failure_in_teardown.rb", "examples/failing/mocking_example.rb", "examples/failing/mocking_with_flexmock.rb", "examples/failing/mocking_with_mocha.rb", "examples/failing/mocking_with_rr.rb", "examples/failing/partial_mock_example.rb", "examples/failing/predicate_example.rb", "examples/failing/raising_example.rb", "examples/failing/spec_helper.rb", "examples/failing/syntax_error_example.rb", "examples/failing/team_spec.rb", "examples/failing/timeout_behaviour.rb", "examples/passing/autogenerated_docstrings_example.rb", "examples/passing/before_and_after_example.rb", "examples/passing/behave_as_example.rb", "examples/passing/custom_expectation_matchers.rb",
"examples/passing/custom_formatter.rb", "examples/passing/dynamic_spec.rb", "examples/passing/file_accessor.rb", "examples/passing/file_accessor_spec.rb", "examples/passing/greeter_spec.rb", "examples/passing/helper_method_example.rb", "examples/passing/io_processor.rb", "examples/passing/io_processor_spec.rb", "examples/passing/legacy_spec.rb", "examples/passing/mocking_example.rb", "examples/passing/multi_threaded_behaviour_runner.rb", "examples/passing/nested_classes_example.rb", "examples/passing/partial_mock_example.rb", "examples/passing/pending_example.rb", "examples/passing/predicate_example.rb", "examples/passing/priority.txt", "examples/passing/shared_example_group_example.rb", "examples/passing/shared_stack_examples.rb", "examples/passing/simple_matcher_example.rb", "examples/passing/spec_helper.rb", "examples/passing/stack.rb", "examples/passing/stack_spec.rb", "examples/passing/stack_spec_with_nested_example_groups.rb", "examples/passing/stubbing_example.rb", "
examples/passing/yielding_example.rb", "init.rb", "lib/autotest/discover.rb", "lib/autotest/rspec.rb", "lib/spec.rb", "lib/spec/adapters.rb", "lib/spec/adapters/ruby_engine.rb", "lib/spec/adapters/ruby_engine/mri.rb", "lib/spec/adapters/ruby_engine/rubinius.rb", "lib/spec/dsl.rb", "lib/spec/dsl/main.rb", "lib/spec/example.rb", "lib/spec/example/before_and_after_hooks.rb", "lib/spec/example/configuration.rb", "lib/spec/example/errors.rb", "lib/spec/example/example_group.rb", "lib/spec/example/example_group_factory.rb", "lib/spec/example/example_group_methods.rb", "lib/spec/example/example_matcher.rb", "lib/spec/example/example_methods.rb", "lib/spec/example/module_reopening_fix.rb", "lib/spec/example/pending.rb", "lib/spec/example/shared_example_group.rb", "lib/spec/expectations.rb", "lib/spec/expectations/differs/default.rb", "lib/spec/expectations/errors.rb", "lib/spec/expectations/extensions.rb", "lib/spec/expectations/extensions/object.rb", "lib/spec/expectations/extensio
ns/string_and_symbol.rb", "lib/spec/expectations/handler.rb", "lib/spec/expectations/wrap_expectation.rb", "lib/spec/extensions.rb", "lib/spec/extensions/class.rb", "lib/spec/interop/test.rb", "lib/spec/interop/test/unit/autorunner.rb", "lib/spec/interop/test/unit/testcase.rb", "lib/spec/interop/test/unit/testresult.rb", "lib/spec/interop/test/unit/testsuite_adapter.rb", "lib/spec/interop/test/unit/ui/console/testrunner.rb", "lib/spec/matchers.rb", "lib/spec/matchers/be.rb", "lib/spec/matchers/be_close.rb", "lib/spec/matchers/change.rb", "lib/spec/matchers/eql.rb", "lib/spec/matchers/equal.rb", "lib/spec/matchers/errors.rb", "lib/spec/matchers/exist.rb", "lib/spec/matchers/generated_descriptions.rb", "lib/spec/matchers/has.rb", "lib/spec/matchers/have.rb", "lib/spec/matchers/include.rb", "lib/spec/matchers/match.rb", "lib/spec/matchers/method_missing.rb", "lib/spec/matchers/operator_matcher.rb", "lib/spec/matchers/raise_error.rb", "lib/spec/matchers/respond_to.rb", "lib/spec
/matchers/satisfy.rb", "lib/spec/matchers/simple_matcher.rb", "lib/spec/matchers/throw_symbol.rb", "lib/spec/mocks.rb", "lib/spec/mocks/argument_constraints.rb", "lib/spec/mocks/argument_expectation.rb", "lib/spec/mocks/error_generator.rb", "lib/spec/mocks/errors.rb", "lib/spec/mocks/extensions.rb", "lib/spec/mocks/extensions/object.rb", "lib/spec/mocks/framework.rb", "lib/spec/mocks/message_expectation.rb", "lib/spec/mocks/methods.rb", "lib/spec/mocks/mock.rb", "lib/spec/mocks/order_group.rb", "lib/spec/mocks/proxy.rb", "lib/spec/mocks/space.rb", "lib/spec/mocks/spec_methods.rb", "lib/spec/rake/spectask.rb", "lib/spec/rake/verify_rcov.rb", "lib/spec/runner.rb", "lib/spec/runner/backtrace_tweaker.rb", "lib/spec/runner/class_and_arguments_parser.rb", "lib/spec/runner/command_line.rb", "lib/spec/runner/drb_command_line.rb", "lib/spec/runner/example_group_runner.rb", "lib/spec/runner/formatter/base_formatter.rb", "lib/spec/runner/formatter/base_text_formatter.rb", "lib/spec/run
ner/formatter/failing_example_groups_formatter.rb", "lib/spec/runner/formatter/failing_examples_formatter.rb", "lib/spec/runner/formatter/html_formatter.rb", "lib/spec/runner/formatter/nested_text_formatter.rb", "lib/spec/runner/formatter/profile_formatter.rb", "lib/spec/runner/formatter/progress_bar_formatter.rb", "lib/spec/runner/formatter/snippet_extractor.rb", "lib/spec/runner/formatter/specdoc_formatter.rb", "lib/spec/runner/formatter/story/html_formatter.rb", "lib/spec/runner/formatter/story/plain_text_formatter.rb", "lib/spec/runner/formatter/story/progress_bar_formatter.rb", "lib/spec/runner/formatter/text_mate_formatter.rb", "lib/spec/runner/heckle_runner.rb", "lib/spec/runner/heckle_runner_unsupported.rb", "lib/spec/runner/option_parser.rb", "lib/spec/runner/options.rb", "lib/spec/runner/reporter.rb", "lib/spec/runner/spec_parser.rb", "lib/spec/story.rb", "lib/spec/story/extensions.rb", "lib/spec/story/extensions/main.rb", "lib/spec/story/extensions/regexp.rb", "li
b/spec/story/extensions/string.rb", "lib/spec/story/given_scenario.rb", "lib/spec/story/runner.rb", "lib/spec/story/runner/plain_text_story_runner.rb", "lib/spec/story/runner/scenario_collector.rb", "lib/spec/story/runner/scenario_runner.rb", "lib/spec/story/runner/story_mediator.rb", "lib/spec/story/runner/story_parser.rb", "lib/spec/story/runner/story_runner.rb", "lib/spec/story/scenario.rb", "lib/spec/story/step.rb", "lib/spec/story/step_group.rb", "lib/spec/story/step_mother.rb", "lib/spec/story/story.rb", "lib/spec/story/world.rb", "lib/spec/version.rb", "plugins/mock_frameworks/flexmock.rb", "plugins/mock_frameworks/mocha.rb", "plugins/mock_frameworks/rr.rb", "plugins/mock_frameworks/rspec.rb", "rake_tasks/examples.rake", "rake_tasks/examples_with_rcov.rake", "rake_tasks/failing_examples_with_html.rake", "rake_tasks/verify_rcov.rake", "rspec.gemspec", "spec/README.jruby", "spec/autotest/autotest_helper.rb", "spec/autotest/autotest_matchers.rb", "spec/autotest/discover_
spec.rb", "spec/autotest/failed_results_re_spec.rb", "spec/autotest/rspec_spec.rb", "spec/rspec_suite.rb", "spec/ruby_forker.rb", "spec/spec.opts", "spec/spec/adapters/ruby_engine_spec.rb", "spec/spec/dsl/main_spec.rb", "spec/spec/example/configuration_spec.rb", "spec/spec/example/example_group_class_definition_spec.rb", "spec/spec/example/example_group_factory_spec.rb", "spec/spec/example/example_group_methods_spec.rb", "spec/spec/example/example_group_spec.rb", "spec/spec/example/example_matcher_spec.rb", "spec/spec/example/example_methods_spec.rb", "spec/spec/example/example_runner_spec.rb", "spec/spec/example/nested_example_group_spec.rb", "spec/spec/example/pending_module_spec.rb", "spec/spec/example/predicate_matcher_spec.rb", "spec/spec/example/shared_example_group_spec.rb", "spec/spec/example/subclassing_example_group_spec.rb", "spec/spec/expectations/differs/default_spec.rb", "spec/spec/expectations/extensions/object_spec.rb", "spec/spec/expectations/fail_with_spec.
rb", "spec/spec/expectations/wrap_expectation_spec.rb", "spec/spec/interop/test/unit/resources/spec_that_fails.rb", "spec/spec/interop/test/unit/resources/spec_that_passes.rb", "spec/spec/interop/test/unit/resources/spec_with_errors.rb", "spec/spec/interop/test/unit/resources/spec_with_options_hash.rb", "spec/spec/interop/test/unit/resources/test_case_that_fails.rb", "spec/spec/interop/test/unit/resources/test_case_that_passes.rb", "spec/spec/interop/test/unit/resources/test_case_with_errors.rb", "spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb", "spec/spec/interop/test/unit/spec_spec.rb", "spec/spec/interop/test/unit/test_unit_spec_helper.rb", "spec/spec/interop/test/unit/testcase_spec.rb", "spec/spec/interop/test/unit/testsuite_adapter_spec.rb", "spec/spec/matchers/be_close_spec.rb", "spec/spec/matchers/be_spec.rb", "spec/spec/matchers/change_spec.rb", "spec/spec/matchers/description_generation_spec.rb", "spec/spec/matchers/eql_spec.rb", "spe
c/spec/matchers/equal_spec.rb", "spec/spec/matchers/exist_spec.rb", "spec/spec/matchers/handler_spec.rb", "spec/spec/matchers/has_spec.rb", "spec/spec/matchers/have_spec.rb", "spec/spec/matchers/include_spec.rb", "spec/spec/matchers/match_spec.rb", "spec/spec/matchers/matcher_methods_spec.rb", "spec/spec/matchers/mock_constraint_matchers_spec.rb", "spec/spec/matchers/operator_matcher_spec.rb", "spec/spec/matchers/raise_error_spec.rb", "spec/spec/matchers/respond_to_spec.rb", "spec/spec/matchers/satisfy_spec.rb", "spec/spec/matchers/simple_matcher_spec.rb", "spec/spec/matchers/throw_symbol_spec.rb", "spec/spec/mocks/any_number_of_times_spec.rb", "spec/spec/mocks/argument_expectation_spec.rb", "spec/spec/mocks/at_least_spec.rb", "spec/spec/mocks/at_most_spec.rb", "spec/spec/mocks/bug_report_10260_spec.rb", "spec/spec/mocks/bug_report_10263_spec.rb", "spec/spec/mocks/bug_report_11545_spec.rb", "spec/spec/mocks/bug_report_15719_spec.rb", "spec/spec/mocks/bug_report_496.rb", "spe
c/spec/mocks/bug_report_600_spec.rb", "spec/spec/mocks/bug_report_7611_spec.rb", "spec/spec/mocks/bug_report_7805_spec.rb", "spec/spec/mocks/bug_report_8165_spec.rb", "spec/spec/mocks/bug_report_8302_spec.rb", "spec/spec/mocks/failing_mock_argument_constraints_spec.rb", "spec/spec/mocks/hash_including_matcher_spec.rb", "spec/spec/mocks/mock_ordering_spec.rb", "spec/spec/mocks/mock_space_spec.rb", "spec/spec/mocks/mock_spec.rb", "spec/spec/mocks/multiple_return_value_spec.rb", "spec/spec/mocks/nil_expectation_warning_spec.rb", "spec/spec/mocks/null_object_mock_spec.rb", "spec/spec/mocks/once_counts_spec.rb", "spec/spec/mocks/options_hash_spec.rb", "spec/spec/mocks/partial_mock_spec.rb", "spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb", "spec/spec/mocks/passing_mock_argument_constraints_spec.rb", "spec/spec/mocks/precise_counts_spec.rb", "spec/spec/mocks/record_messages_spec.rb", "spec/spec/mocks/stub_spec.rb", "spec/spec/mocks/twice_counts_spec.rb", "spec/spec/pack
age/bin_spec_spec.rb", "spec/spec/runner/class_and_argument_parser_spec.rb", "spec/spec/runner/command_line_spec.rb", "spec/spec/runner/drb_command_line_spec.rb", "spec/spec/runner/empty_file.txt", "spec/spec/runner/examples.txt", "spec/spec/runner/failed.txt", "spec/spec/runner/formatter/base_formatter_spec.rb", "spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb", "spec/spec/runner/formatter/failing_examples_formatter_spec.rb", "spec/spec/runner/formatter/html_formatted-1.8.4.html", "spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html", "spec/spec/runner/formatter/html_formatted-1.8.5.html", "spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html", "spec/spec/runner/formatter/html_formatted-1.8.6.html", "spec/spec/runner/formatter/html_formatter_spec.rb", "spec/spec/runner/formatter/nested_text_formatter_spec.rb", "spec/spec/runner/formatter/profile_formatter_spec.rb", "spec/spec/runner/formatter/progress_bar_formatter_spec.rb", "spec/spec/runne
r/formatter/snippet_extractor_spec.rb", "spec/spec/runner/formatter/spec_mate_formatter_spec.rb", "spec/spec/runner/formatter/specdoc_formatter_spec.rb", "spec/spec/runner/formatter/story/html_formatter_spec.rb", "spec/spec/runner/formatter/story/plain_text_formatter_spec.rb", "spec/spec/runner/formatter/story/progress_bar_formatter_spec.rb", "spec/spec/runner/formatter/text_mate_formatted-1.8.4.html", "spec/spec/runner/formatter/text_mate_formatted-1.8.6.html", "spec/spec/runner/heckle_runner_spec.rb", "spec/spec/runner/heckler_spec.rb", "spec/spec/runner/noisy_backtrace_tweaker_spec.rb", "spec/spec/runner/option_parser_spec.rb", "spec/spec/runner/options_spec.rb", "spec/spec/runner/output_one_time_fixture.rb", "spec/spec/runner/output_one_time_fixture_runner.rb", "spec/spec/runner/output_one_time_spec.rb", "spec/spec/runner/quiet_backtrace_tweaker_spec.rb", "spec/spec/runner/reporter_spec.rb", "spec/spec/runner/resources/a_bar.rb", "spec/spec/runner/resources/a_foo.rb", "s
pec/spec/runner/resources/a_spec.rb", "spec/spec/runner/spec.opts", "spec/spec/runner/spec_drb.opts", "spec/spec/runner/spec_parser/spec_parser_fixture.rb", "spec/spec/runner/spec_parser_spec.rb", "spec/spec/runner/spec_spaced.opts", "spec/spec/runner_spec.rb", "spec/spec/spec_classes.rb", "spec/spec/story/builders.rb", "spec/spec/story/extensions/main_spec.rb", "spec/spec/story/extensions_spec.rb", "spec/spec/story/given_scenario_spec.rb", "spec/spec/story/runner/plain_text_story_runner_spec.rb", "spec/spec/story/runner/scenario_collector_spec.rb", "spec/spec/story/runner/scenario_runner_spec.rb", "spec/spec/story/runner/story_mediator_spec.rb", "spec/spec/story/runner/story_parser_spec.rb", "spec/spec/story/runner/story_runner_spec.rb", "spec/spec/story/runner_spec.rb", "spec/spec/story/scenario_spec.rb", "spec/spec/story/step_group_spec.rb", "spec/spec/story/step_mother_spec.rb", "spec/spec/story/step_spec.rb", "spec/spec/story/story_helper.rb", "spec/spec/story/story_spe
c.rb", "spec/spec/story/world_spec.rb", "spec/spec_helper.rb", "stories/all.rb", "stories/configuration/before_blocks.story", "stories/configuration/stories.rb", "stories/example_groups/autogenerated_docstrings", "stories/example_groups/example_group_with_should_methods", "stories/example_groups/nested_groups", "stories/example_groups/output", "stories/example_groups/stories.rb", "stories/helper.rb", "stories/interop/examples_and_tests_together", "stories/interop/stories.rb", "stories/interop/test_but_not_test_unit", "stories/interop/test_case_with_should_methods", "stories/mock_framework_integration/stories.rb", "stories/mock_framework_integration/use_flexmock.story", "stories/pending_stories/README", "stories/resources/helpers/cmdline.rb", "stories/resources/helpers/story_helper.rb", "stories/resources/matchers/smart_match.rb", "stories/resources/spec/before_blocks_example.rb", "stories/resources/spec/example_group_with_should_methods.rb", "stories/resources/spec/simple_sp
ec.rb", "stories/resources/spec/spec_with_flexmock.rb", "stories/resources/steps/running_rspec.rb", "stories/resources/stories/failing_story.rb", "stories/resources/test/spec_and_test_together.rb", "stories/resources/test/spec_including_test_but_not_unit.rb", "stories/resources/test/test_case_with_should_methods.rb", "stories/stories/multiline_steps.story", "stories/stories/steps/multiline_steps.rb", "stories/stories/stories.rb", "story_server/prototype/javascripts/builder.js", "story_server/prototype/javascripts/controls.js", "story_server/prototype/javascripts/dragdrop.js", "story_server/prototype/javascripts/effects.js", "story_server/prototype/javascripts/prototype.js", "story_server/prototype/javascripts/rspec.js", "story_server/prototype/javascripts/scriptaculous.js", "story_server/prototype/javascripts/slider.js", "story_server/prototype/javascripts/sound.js", "story_server/prototype/javascripts/unittest.js", "story_server/prototype/lib/server.rb", "story_server/proto
type/stories.html", "story_server/prototype/stylesheets/rspec.css", "story_server/prototype/stylesheets/test.css"]
+ s.has_rdoc = true
+ s.homepage = %q{http://rspec.info/}
+ s.rdoc_options = ["--main", "README.txt"]
+ s.require_paths = ["lib"]
+ s.rubyforge_project = %q{rspec}
+ s.rubygems_version = %q{1.3.1}
+ s.summary = %q{rspec 1.1.11.1}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 2
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
+ end
+ end
+end
Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/autotest_helper.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/autotest_helper.rb?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/autotest_helper.rb (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/autotest_helper.rb Wed Dec 10 17:34:18 2008
@@ -0,0 +1,6 @@
+require "rubygems"
+require 'autotest'
+dir = File.dirname(__FILE__)
+require File.expand_path("#{dir}/../spec_helper")
+require File.expand_path("#{dir}/../../lib/autotest/rspec")
+require File.expand_path("#{dir}/autotest_matchers")
Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/autotest_matchers.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/autotest_matchers.rb?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/autotest_matchers.rb (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/autotest_matchers.rb Wed Dec 10 17:34:18 2008
@@ -0,0 +1,47 @@
+module Spec
+ module Matchers
+ class AutotestMappingMatcher
+ def initialize(specs)
+ @specs = specs
+ end
+
+ def to(file)
+ @file = file
+ self
+ end
+
+ def matches?(autotest)
+ @autotest = prepare autotest
+ @actual = autotest.test_files_for(@file)
+ @actual == @specs
+ end
+
+ def failure_message
+ "expected #{@autotest.class} to map #{@specs.inspect} to #{@file.inspect}\ngot #{@actual.inspect}"
+ end
+
+ private
+ def prepare autotest
+ stub_found_files autotest
+ stub_find_order autotest
+ autotest
+ end
+
+ def stub_found_files autotest
+ found_files = @specs.inject({}){|h,f| h[f] = Time.at(0)}
+ autotest.stub!(:find_files).and_return(found_files)
+ end
+
+ def stub_find_order autotest
+ find_order = @specs.dup << @file
+ autotest.instance_eval { @find_order = find_order }
+ end
+
+ end
+
+ def map_specs(specs)
+ AutotestMappingMatcher.new(specs)
+ end
+
+ end
+end
\ No newline at end of file
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/discover_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/discover_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/discover_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/discover_spec.rb Wed Dec 10 17:34:18 2008
@@ -1,19 +1,8 @@
-require File.dirname(__FILE__) + "/../autotest_helper"
+require File.dirname(__FILE__) + "/autotest_helper"
-module DiscoveryHelper
- def load_discovery
+describe Autotest::Rspec, "discovery" do
+ it "adds the rspec autotest plugin" do
+ Autotest.should_receive(:add_discovery)
require File.dirname(__FILE__) + "/../../lib/autotest/discover"
end
-end
-
-
-class Autotest
- describe Rspec, "discovery" do
- include DiscoveryHelper
-
- it "should add the rspec autotest plugin" do
- Autotest.should_receive(:add_discovery).and_yield
- load_discovery
- end
- end
-end
+end
Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/failed_results_re_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/failed_results_re_spec.rb?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/failed_results_re_spec.rb (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/failed_results_re_spec.rb Wed Dec 10 17:34:18 2008
@@ -0,0 +1,24 @@
+require File.dirname(__FILE__) + "/autotest_helper"
+
+describe "failed_results_re" do
+ it "should match a failure" do
+ re = Autotest::Rspec.new.failed_results_re
+ re =~ "1)\n'this example' FAILED\nreason\n/path.rb:37:\n\n"
+ $1.should == "this example"
+ $2.should == "reason\n/path.rb:37:"
+ end
+
+ it "should match an Error" do
+ re = Autotest::Rspec.new.failed_results_re
+ re =~ "1)\nRuntimeError in 'this example'\nreason\n/path.rb:37:\n\n"
+ $1.should == "this example"
+ $2.should == "reason\n/path.rb:37:"
+ end
+
+ it "should match an Error that doesn't end in Error" do
+ re = Autotest::Rspec.new.failed_results_re
+ re =~ "1)\nInvalidArgument in 'this example'\nreason\n/path.rb:37:\n\n"
+ $1.should == "this example"
+ $2.should == "reason\n/path.rb:37:"
+ end
+end
\ No newline at end of file
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/rspec_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/rspec_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/rspec_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/autotest/rspec_spec.rb Wed Dec 10 17:34:18 2008
@@ -1,98 +1,8 @@
-require File.dirname(__FILE__) + "/../autotest_helper"
+require File.dirname(__FILE__) + "/autotest_helper"
class Autotest
- module AutotestHelper
- def rspec_output
- <<-HERE
-.............PPF
-
-1)
-'false should be false' FAILED
-expected: true,
- got: false (using ==)
-./spec/autotest/rspec_spec.rb:203:
-
-Finished in 0.158674 seconds
-
-16 examples, 1 failure, 2 pending
-
-Pending:
-Autotest::Rspec handling failed results should return an array of failed examples and errors (TODO)
-Autotest::Rspec tests/specs for a given file should find all the specs for a given file (TODO)
-HERE
- end
-
- def common_setup
- @proc = mock Proc
- @kernel = mock Kernel
- @kernel.stub!(:proc).and_return @proc
-
- File.stub!(:exists).and_return true
- @windows_alt_separator = "\\"
- @posix_separator = '/'
-
- @rspec_output = rspec_output
- end
- end
-
describe Rspec do
- describe "selection of rspec command" do
- include AutotestHelper
-
- before(:each) do
- common_setup
- @rspec_autotest = Rspec.new
- end
-
- it "should try to find the spec command if it exists in ./bin and use it above everything else" do
- File.stub!(:exists?).and_return true
-
- spec_path = File.expand_path("#{File.dirname(__FILE__)}/../../bin/spec")
- File.should_receive(:exists?).with(spec_path).and_return true
- @rspec_autotest.spec_command.should == spec_path
- end
-
- it "should otherwise select the default spec command in gem_dir/bin/spec" do
- @rspec_autotest.stub!(:spec_commands).and_return ["/foo/spec"]
- Config::CONFIG.stub!(:[]).and_return "/foo"
- File.should_receive(:exists?).with("/foo/spec").and_return(true)
-
- @rspec_autotest.spec_command.should == "/foo/spec"
- end
-
- it "should raise an error if no spec command is found at all" do
- File.stub!(:exists?).and_return false
-
- lambda {
- @rspec_autotest.spec_command
- }.should raise_error(RspecCommandError, "No spec command could be found!")
- end
- end
-
- describe "selection of rspec command (windows compatibility issues)" do
- include AutotestHelper
-
- before(:each) do
- common_setup
- end
-
- it "should use the ALT_SEPARATOR if it is non-nil" do
- @rspec_autotest = Rspec.new
- spec_command = File.expand_path("#{File.dirname(__FILE__)}/../../bin/spec")
- @rspec_autotest.stub!(:spec_commands).and_return [spec_command]
- @rspec_autotest.spec_command(@windows_alt_separator).should == spec_command.gsub('/', @windows_alt_separator)
- end
-
- it "should not use the ALT_SEPATOR if it is nil" do
- @windows_alt_separator = nil
- @rspec_autotest = Rspec.new
- spec_command = File.expand_path("#{File.dirname(__FILE__)}/../../bin/spec")
- @rspec_autotest.stub!(:spec_commands).and_return [spec_command]
- @rspec_autotest.spec_command.should == spec_command
- end
- end
-
describe "adding spec.opts --options" do
before(:each) do
@rspec_autotest = Rspec.new
@@ -116,7 +26,7 @@
@rspec_autotest.stub!(:add_options_if_present).and_return "-O spec/spec.opts"
@ruby = @rspec_autotest.ruby
- @spec_command = @rspec_autotest.spec_command
+ @spec_cmd = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec'))
@options = @rspec_autotest.add_options_if_present
@files_to_test = {
:spec => ["file_one", "file_two"]
@@ -126,16 +36,13 @@
@files_to_test.stub!(:keys).and_return @files_to_test[:spec]
@to_test = @files_to_test.keys.flatten.join ' '
end
-
- it "should contain the various commands, ordered by preference" do
- Rspec.new.spec_commands.should == [
- File.expand_path("#{File.dirname(__FILE__)}/../../bin/spec"),
- "#{Config::CONFIG['bindir']}/spec"
- ]
- end
- it "should make the apropriate test command" do
- @rspec_autotest.make_test_cmd(@files_to_test).should == "#{@ruby} -S #{@spec_command} #{@options} #{@to_test}"
+ it "should make the appropriate test command" do
+ @rspec_autotest.make_test_cmd(@files_to_test).should == "#{@ruby} #{@spec_cmd} #{@to_test} #{@options}"
+ end
+
+ it "should return a blank command for no files" do
+ @rspec_autotest.make_test_cmd({}).should == ''
end
end
@@ -156,16 +63,17 @@
@rspec_autotest.should map_specs([@spec_file]).to(@spec_file)
end
- it "should only find the file if the file is being tracked (in @file)" do
+ it "should ignore files in spec dir that aren't specs" do
+ @rspec_autotest.should map_specs([]).to("spec/spec_helper.rb")
+ end
+
+ it "should ignore untracked files (in @file)" do
@rspec_autotest.should map_specs([]).to("lib/untracked_file")
end
end
describe "consolidating failures" do
- include AutotestHelper
-
before(:each) do
- common_setup
@rspec_autotest = Rspec.new
@spec_file = "spec/autotest/some_spec.rb"
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/rspec_suite.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/rspec_suite.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/rspec_suite.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/rspec_suite.rb Wed Dec 10 17:34:18 2008
@@ -1,7 +1,6 @@
if __FILE__ == $0
dir = File.dirname(__FILE__)
Dir["#{dir}/**/*_spec.rb"].reverse.each do |file|
-# puts "require '#{file}'"
require file
end
end
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/adapters/ruby_engine_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/adapters/ruby_engine_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/adapters/ruby_engine_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/adapters/ruby_engine_spec.rb Wed Dec 10 17:34:18 2008
@@ -7,4 +7,10 @@
Spec::Adapters::RubyEngine.stub!(:engine).and_return('rbx')
Spec::Adapters::RubyEngine.adapter.should be_an_instance_of(Spec::Adapters::RubyEngine::Rubinius)
end
+
+ it "should try to find whatever is defined by the RUBY_ENGINE const" do
+ Object.stub!(:const_defined?).with('RUBY_ENGINE').and_return(true)
+ Object.stub!(:const_get).with('RUBY_ENGINE').and_return("xyz")
+ Spec::Adapters::RubyEngine.engine.should == "xyz"
+ end
end
\ No newline at end of file
Added: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/dsl/main_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/dsl/main_spec.rb?rev=725524&view=auto
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/dsl/main_spec.rb (added)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/dsl/main_spec.rb Wed Dec 10 17:34:18 2008
@@ -0,0 +1,65 @@
+require File.dirname(__FILE__) + '/../../spec_helper.rb'
+
+module Spec
+ module DSL
+ describe Main do
+ before(:each) do
+ @main = Class.new do; include Main; end
+ end
+
+ [:describe, :context].each do |method|
+ describe "##{method}" do
+ it "should delegate to Spec::Example::ExampleGroupFactory.create_example_group" do
+ block = lambda {}
+ Spec::Example::ExampleGroupFactory.should_receive(:create_example_group).with(
+ "The ExampleGroup", &block
+ )
+ @main.__send__ method, "The ExampleGroup", &block
+ end
+ end
+ end
+
+ [:share_examples_for, :shared_examples_for].each do |method|
+ describe "##{method}" do
+ it "should create a shared ExampleGroup" do
+ block = lambda {}
+ Spec::Example::SharedExampleGroup.should_receive(:register).with(
+ "shared group", &block
+ )
+ @main.__send__ method, "shared group", &block
+ end
+ end
+ end
+
+ describe "#share_as" do
+ def self.next_group_name
+ @group_number ||= 0
+ @group_number += 1
+ "Group#{@group_number}"
+ end
+
+ def group_name
+ @group_name ||= self.class.next_group_name
+ end
+
+ it "registers a shared ExampleGroup" do
+ Spec::Example::SharedExampleGroup.should_receive(:register)
+ group = @main.share_as group_name do end
+ end
+
+ it "creates a constant that points to a Module" do
+ group = @main.share_as group_name do end
+ Object.const_get(group_name).should equal(group)
+ end
+
+ it "complains if you pass it a not-constantizable name" do
+ lambda do
+ @group = @main.share_as "Non Constant" do end
+ end.should raise_error(NameError, /The first argument to share_as must be a legal name for a constant/)
+ end
+
+ end
+ end
+ end
+end
+
\ No newline at end of file
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/example/configuration_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/example/configuration_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/example/configuration_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/example/configuration_spec.rb Wed Dec 10 17:34:18 2008
@@ -2,279 +2,293 @@
module Spec
module Example
-
describe Configuration do
- before(:each) do
- @config = Configuration.new
- @example_group = mock("example_group")
- end
-
+
describe "#mock_with" do
+ before(:each) do
+ @config = Configuration.new
+ @example_group = mock("example_group")
+ end
+
it "should default mock framework to rspec" do
@config.mock_framework.should =~ /\/plugins\/mock_frameworks\/rspec$/
end
- it "should let you set rspec mocking explicitly" do
+ it "should set rspec mocking explicitly" do
@config.mock_with(:rspec)
@config.mock_framework.should =~ /\/plugins\/mock_frameworks\/rspec$/
end
- it "should let you set mocha" do
+ it "should set mocha" do
@config.mock_with(:mocha)
@config.mock_framework.should =~ /\/plugins\/mock_frameworks\/mocha$/
end
- it "should let you set flexmock" do
+ it "should set flexmock" do
@config.mock_with(:flexmock)
@config.mock_framework.should =~ /\/plugins\/mock_frameworks\/flexmock$/
end
- it "should let you set rr" do
+ it "should set rr" do
@config.mock_with(:rr)
@config.mock_framework.should =~ /\/plugins\/mock_frameworks\/rr$/
end
- it "should let you set an arbitrary adapter module" do
+ it "should set an arbitrary adapter module" do
adapter = Module.new
@config.mock_with(adapter)
@config.mock_framework.should == adapter
end
end
- describe "#include" do
+ with_sandboxed_config do
- before do
- @original_configuration = Spec::Runner.configuration
- spec_configuration = @config
- Spec::Runner.instance_eval {@configuration = spec_configuration}
- @example_group_class = Class.new(ExampleGroup) do
- class << self
- def this_class_has_special_methods
- end
- end
+ describe "#include" do
+
+ before(:each) do
+ @example_group_class = Class.new(ExampleGroup) {}
+ ExampleGroupFactory.register(:foobar, @example_group_class)
end
- ExampleGroupFactory.register(:foobar, @example_group_class)
- end
- after do
- original_configuration = @original_configuration
- Spec::Runner.instance_eval {@configuration = original_configuration}
- ExampleGroupFactory.reset
- end
+ it "should include the submitted module in ExampleGroup subclasses" do
+ mod = Module.new
+ config.include mod
+ Class.new(@example_group_class).included_modules.should include(mod)
+ end
- it "should include the submitted module in ExampleGroup subclasses" do
- mod = Module.new
- @config.include mod
- Class.new(@example_group_class).included_modules.should include(mod)
- end
+ it "should scope modules to be included for a specific type" do
+ mod = Module.new
+ config.include mod, :type => :foobar
+ Class.new(@example_group_class).included_modules.should include(mod)
+ end
- it "should let you define modules to be included for a specific type" do
- mod = Module.new
- @config.include mod, :type => :foobar
- Class.new(@example_group_class).included_modules.should include(mod)
- end
+ it "should not include modules in a type they are not intended for" do
+ mod = Module.new
+ @other_example_group_class = Class.new(ExampleGroup)
+ ExampleGroupFactory.register(:baz, @other_example_group_class)
- it "should not include modules in a type they are not intended for" do
- mod = Module.new
- @other_example_group_class = Class.new(ExampleGroup)
- ExampleGroupFactory.register(:baz, @other_example_group_class)
+ config.include mod, :type => :foobar
- @config.include mod, :type => :foobar
+ Class.new(@other_example_group_class).included_modules.should_not include(mod)
+ end
- Class.new(@other_example_group_class).included_modules.should_not include(mod)
end
-
- end
-
- end
-
- describe Configuration do
- before(:each) do
- @config = Configuration.new
- @special_example_group = Class.new(ExampleGroup)
- @special_child_example_group = Class.new(@special_example_group)
- @nonspecial_example_group = Class.new(ExampleGroup)
- ExampleGroupFactory.register(:special, @special_example_group)
- ExampleGroupFactory.register(:special_child, @special_child_example_group)
- ExampleGroupFactory.register(:non_special, @nonspecial_example_group)
- @example_group = @special_child_example_group.describe "Special Example Group"
- @unselected_example_group = Class.new(@nonspecial_example_group).describe "Non Special Example Group"
- end
-
- after(:each) do
- ExampleGroupFactory.reset
- end
-
- describe "#prepend_before" do
- it "prepends the before block on all instances of the passed in type" do
- order = []
- @config.prepend_before(:all) do
- order << :prepend__before_all
- end
- @config.prepend_before(:all, :type => :special) do
- order << :special_prepend__before_all
- end
- @config.prepend_before(:all, :type => :special_child) do
- order << :special_child_prepend__before_all
- end
- @config.prepend_before(:each) do
- order << :prepend__before_each
- end
- @config.prepend_before(:each, :type => :special) do
- order << :special_prepend__before_each
- end
- @config.prepend_before(:each, :type => :special_child) do
- order << :special_child_prepend__before_each
+ describe "#extend" do
+
+ before(:each) do
+ @example_group_class = Class.new(ExampleGroup) {}
+ ExampleGroupFactory.register(:foobar, @example_group_class)
end
- @config.prepend_before(:all, :type => :non_special) do
- order << :special_prepend__before_all
+
+ it "should extend all groups" do
+ mod = Module.new
+ ExampleGroup.should_receive(:extend).with(mod)
+ Spec::Runner.configuration.extend mod
end
- @config.prepend_before(:each, :type => :non_special) do
- order << :special_prepend__before_each
+
+ it "should extend specified groups" do
+ mod = Module.new
+ @example_group_class.should_receive(:extend).with(mod)
+ Spec::Runner.configuration.extend mod, :type => :foobar
end
- @example_group.it "calls prepend_before" do
+
+ it "should not extend non-specified groups" do
+ @other_example_group_class = Class.new(ExampleGroup)
+ ExampleGroupFactory.register(:baz, @other_example_group_class)
+
+ mod = Module.new
+ @other_example_group_class.should_not_receive(:extend)
+
+ Spec::Runner.configuration.extend mod, :type => :foobar
end
- @example_group.run
- order.should == [
- :prepend__before_all,
- :special_prepend__before_all,
- :special_child_prepend__before_all,
- :prepend__before_each,
- :special_prepend__before_each,
- :special_child_prepend__before_each
- ]
end
end
- describe "#append_before" do
-
- it "calls append_before on the type" do
- order = []
- @config.append_before(:all) do
- order << :append_before_all
- end
- @config.append_before(:all, :type => :special) do
- order << :special_append_before_all
- end
- @config.append_before(:all, :type => :special_child) do
- order << :special_child_append_before_all
- end
- @config.append_before(:each) do
- order << :append_before_each
- end
- @config.append_before(:each, :type => :special) do
- order << :special_append_before_each
- end
- @config.append_before(:each, :type => :special_child) do
- order << :special_child_append_before_each
- end
- @config.append_before(:all, :type => :non_special) do
- order << :special_append_before_all
- end
- @config.append_before(:each, :type => :non_special) do
- order << :special_append_before_each
- end
- @example_group.it "calls append_before" do
+ describe Configuration do
+
+ before(:each) do
+ @special_example_group = Class.new(ExampleGroup).describe("special_example_group")
+ @special_child_example_group = Class.new(@special_example_group).describe("special_child_example_group")
+ @nonspecial_example_group = Class.new(ExampleGroup).describe("nonspecial_example_group")
+ ExampleGroupFactory.register(:special, @special_example_group)
+ ExampleGroupFactory.register(:special_child, @special_child_example_group)
+ ExampleGroupFactory.register(:non_special, @nonspecial_example_group)
+ @example_group = @special_child_example_group.describe "Special Example Group"
+ @unselected_example_group = Class.new(@nonspecial_example_group).describe "Non Special Example Group"
+ end
+
+ describe "#prepend_before" do
+ it "prepends the before block on all instances of the passed in type" do
+ order = []
+ config.prepend_before(:all) do
+ order << :prepend__before_all
+ end
+ config.prepend_before(:all, :type => :special) do
+ order << :special_prepend__before_all
+ end
+ config.prepend_before(:all, :type => :special_child) do
+ order << :special_child_prepend__before_all
+ end
+ config.prepend_before(:each) do
+ order << :prepend__before_each
+ end
+ config.prepend_before(:each, :type => :special) do
+ order << :special_prepend__before_each
+ end
+ config.prepend_before(:each, :type => :special_child) do
+ order << :special_child_prepend__before_each
+ end
+ config.prepend_before(:all, :type => :non_special) do
+ order << :special_prepend__before_all
+ end
+ config.prepend_before(:each, :type => :non_special) do
+ order << :special_prepend__before_each
+ end
+ @example_group.it "calls prepend_before" do
+ end
+
+ @example_group.run
+ order.should == [
+ :prepend__before_all,
+ :special_prepend__before_all,
+ :special_child_prepend__before_all,
+ :prepend__before_each,
+ :special_prepend__before_each,
+ :special_child_prepend__before_each
+ ]
end
-
- @example_group.run
- order.should == [
- :append_before_all,
- :special_append_before_all,
- :special_child_append_before_all,
- :append_before_each,
- :special_append_before_each,
- :special_child_append_before_each
- ]
end
- end
- describe "#prepend_after" do
+ describe "#append_before" do
+
+ it "calls append_before on the type" do
+ order = []
+ config.append_before(:all) do
+ order << :append_before_all
+ end
+ config.append_before(:all, :type => :special) do
+ order << :special_append_before_all
+ end
+ config.append_before(:all, :type => :special_child) do
+ order << :special_child_append_before_all
+ end
+ config.append_before(:each) do
+ order << :append_before_each
+ end
+ config.append_before(:each, :type => :special) do
+ order << :special_append_before_each
+ end
+ config.append_before(:each, :type => :special_child) do
+ order << :special_child_append_before_each
+ end
+ config.append_before(:all, :type => :non_special) do
+ order << :special_append_before_all
+ end
+ config.append_before(:each, :type => :non_special) do
+ order << :special_append_before_each
+ end
+ @example_group.it "calls append_before" do
+ end
- it "prepends the after block on all instances of the passed in type" do
- order = []
- @config.prepend_after(:all) do
- order << :prepend__after_all
- end
- @config.prepend_after(:all, :type => :special) do
- order << :special_prepend__after_all
+ @example_group.run
+ order.should == [
+ :append_before_all,
+ :special_append_before_all,
+ :special_child_append_before_all,
+ :append_before_each,
+ :special_append_before_each,
+ :special_child_append_before_each
+ ]
end
- @config.prepend_after(:all, :type => :special) do
- order << :special_child_prepend__after_all
- end
- @config.prepend_after(:each) do
- order << :prepend__after_each
- end
- @config.prepend_after(:each, :type => :special) do
- order << :special_prepend__after_each
- end
- @config.prepend_after(:each, :type => :special) do
- order << :special_child_prepend__after_each
- end
- @config.prepend_after(:all, :type => :non_special) do
- order << :special_prepend__after_all
- end
- @config.prepend_after(:each, :type => :non_special) do
- order << :special_prepend__after_each
- end
- @example_group.it "calls prepend_after" do
- end
-
- @example_group.run
- order.should == [
- :special_child_prepend__after_each,
- :special_prepend__after_each,
- :prepend__after_each,
- :special_child_prepend__after_all,
- :special_prepend__after_all,
- :prepend__after_all
- ]
end
- end
- describe "#append_after" do
+ describe "#prepend_after" do
+
+ it "prepends the after block on all instances of the passed in type" do
+ order = []
+ config.prepend_after(:all) do
+ order << :prepend__after_all
+ end
+ config.prepend_after(:all, :type => :special) do
+ order << :special_prepend__after_all
+ end
+ config.prepend_after(:all, :type => :special) do
+ order << :special_child_prepend__after_all
+ end
+ config.prepend_after(:each) do
+ order << :prepend__after_each
+ end
+ config.prepend_after(:each, :type => :special) do
+ order << :special_prepend__after_each
+ end
+ config.prepend_after(:each, :type => :special) do
+ order << :special_child_prepend__after_each
+ end
+ config.prepend_after(:all, :type => :non_special) do
+ order << :special_prepend__after_all
+ end
+ config.prepend_after(:each, :type => :non_special) do
+ order << :special_prepend__after_each
+ end
+ @example_group.it "calls prepend_after" do
+ end
- it "calls append_after on the type" do
- order = []
- @config.append_after(:all) do
- order << :append__after_all
- end
- @config.append_after(:all, :type => :special) do
- order << :special_append__after_all
- end
- @config.append_after(:all, :type => :special_child) do
- order << :special_child_append__after_all
- end
- @config.append_after(:each) do
- order << :append__after_each
- end
- @config.append_after(:each, :type => :special) do
- order << :special_append__after_each
- end
- @config.append_after(:each, :type => :special_child) do
- order << :special_child_append__after_each
- end
- @config.append_after(:all, :type => :non_special) do
- order << :non_special_append_after_all
- end
- @config.append_after(:each, :type => :non_special) do
- order << :non_special_append_after_each
- end
- @example_group.it "calls append_after" do
+ @example_group.run
+ order.should == [
+ :special_child_prepend__after_each,
+ :special_prepend__after_each,
+ :prepend__after_each,
+ :special_child_prepend__after_all,
+ :special_prepend__after_all,
+ :prepend__after_all
+ ]
end
+ end
+
+ describe "#append_after" do
+
+ it "calls append_after on the type" do
+ order = []
+ config.append_after(:all) do
+ order << :append__after_all
+ end
+ config.append_after(:all, :type => :special) do
+ order << :special_append__after_all
+ end
+ config.append_after(:all, :type => :special_child) do
+ order << :special_child_append__after_all
+ end
+ config.append_after(:each) do
+ order << :append__after_each
+ end
+ config.append_after(:each, :type => :special) do
+ order << :special_append__after_each
+ end
+ config.append_after(:each, :type => :special_child) do
+ order << :special_child_append__after_each
+ end
+ config.append_after(:all, :type => :non_special) do
+ order << :non_special_append_after_all
+ end
+ config.append_after(:each, :type => :non_special) do
+ order << :non_special_append_after_each
+ end
+ @example_group.it "calls append_after" do
+ end
- @example_group.run
- order.should == [
- :special_child_append__after_each,
- :special_append__after_each,
- :append__after_each,
- :special_child_append__after_all,
- :special_append__after_all,
- :append__after_all
- ]
+ @example_group.run
+ order.should == [
+ :special_child_append__after_each,
+ :special_append__after_each,
+ :append__after_each,
+ :special_child_append__after_all,
+ :special_append__after_all,
+ :append__after_all
+ ]
+ end
end
end
end
Modified: incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/example/example_group_class_definition_spec.rb
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/example/example_group_class_definition_spec.rb?rev=725524&r1=725523&r2=725524&view=diff
==============================================================================
--- incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/example/example_group_class_definition_spec.rb (original)
+++ incubator/olio/webapp/rails/trunk/vendor/plugins/rspec/spec/spec/example/example_group_class_definition_spec.rb Wed Dec 10 17:34:18 2008
@@ -3,37 +3,41 @@
module Spec
module Example
class ExampleGroupSubclass < ExampleGroup
- class << self
- attr_accessor :examples_ran
+ def self.examples_ran
+ @examples_ran
end
- @@klass_variable_set = true
- CONSTANT = :foobar
+ def self.examples_ran=(examples_ran)
+ @examples_ran = examples_ran
+ end
+
+ @@class_variable = :class_variable
+ CONSTANT = :constant
before do
- @instance_variable = :hello
+ @instance_variable = :instance_variable
end
-
- it "should run" do
+
+ after(:all) do
self.class.examples_ran = true
end
it "should have access to instance variables" do
- @instance_variable.should == :hello
+ @instance_variable.should == :instance_variable
end
it "should have access to class variables" do
- @@klass_variable_set.should == true
+ @@class_variable.should == :class_variable
end
it "should have access to constants" do
- CONSTANT.should == :foobar
+ CONSTANT.should == :constant
end
it "should have access to methods defined in the Example Group" do
a_method.should == 22
end
-
+
def a_method
22
end