mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-20 06:08:08 +01:00
Next step in upgrading Tracks to Rails 2.2. Some highlights:
* Ran rake rails:update * Added old actionwebservice framework * Updated RSpec and RSpec-Rails * Removed asset_packager plugin (not compatible, Scott no longer maintaining), and replaced with bundle_fu. See the bundle_fu README for more info. * Hacks to UJS and ARTS plugins, which are no longer supported. Probably should move off both UJS and RJS. * Hack to flashobject_helper plugin (upgrade to Rails 2.2-compatible version if/when it comes out.) * Hack to skinny-spec plugin, for Rails 2.2 compatibility. Should check for official release. * Hacks to resource_feeder plugin, for Rails 2.2 compatibility. Should check for official release (not likely) or move off it. * Addressed some deprecation warnings. More to come. * My mobile mime type hackery is no longer necessary with new Rails features. Yay! * Updated environment.rb.tmpl with changes TODO: * Restore view specs marked pending * Fix failing integration tests. * Try selenium tests. * Investigate OpenID support. * Address deprecation warnings. * Consider moving parts of environment.rb to initializers * Address annoying config.gem warning about highline gem
This commit is contained in:
parent
6d11ebd1b0
commit
35ae5fc431
394 changed files with 15184 additions and 9936 deletions
25
vendor/plugins/rspec/lib/spec/example/errors.rb
vendored
25
vendor/plugins/rspec/lib/spec/example/errors.rb
vendored
|
|
@ -1,9 +1,30 @@
|
|||
module Spec
|
||||
module Example
|
||||
class ExamplePendingError < StandardError
|
||||
attr_reader :pending_caller
|
||||
|
||||
def initialize(message=nil)
|
||||
super
|
||||
@pending_caller = caller[2]
|
||||
end
|
||||
end
|
||||
|
||||
class NotYetImplementedError < ExamplePendingError
|
||||
MESSAGE = "Not Yet Implemented"
|
||||
RSPEC_ROOT_LIB = File.expand_path(File.dirname(__FILE__) + "/../..")
|
||||
|
||||
def initialize(backtrace)
|
||||
super(MESSAGE)
|
||||
@pending_caller = pending_caller_from(backtrace)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def pending_caller_from(backtrace)
|
||||
backtrace.detect {|line| !line.include?(RSPEC_ROOT_LIB) }
|
||||
end
|
||||
end
|
||||
|
||||
class PendingExampleFixedError < StandardError
|
||||
end
|
||||
class PendingExampleFixedError < StandardError; end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,9 +6,17 @@ module Spec
|
|||
extend Spec::Example::ExampleGroupMethods
|
||||
include Spec::Example::ExampleMethods
|
||||
|
||||
def initialize(defined_description, &implementation)
|
||||
def initialize(defined_description, options={}, &implementation)
|
||||
@_options = options
|
||||
@_defined_description = defined_description
|
||||
@_implementation = implementation
|
||||
@_implementation = implementation || pending_implementation
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def pending_implementation
|
||||
error = NotYetImplementedError.new(caller)
|
||||
lambda { raise(error) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ module Spec
|
|||
end
|
||||
|
||||
attr_reader :description_text, :description_args, :description_options, :spec_path, :registration_binding_block
|
||||
alias :options :description_options
|
||||
|
||||
def inherited(klass)
|
||||
super
|
||||
|
|
@ -38,24 +39,30 @@ module Spec
|
|||
def describe(*args, &example_group_block)
|
||||
args << {} unless Hash === args.last
|
||||
if example_group_block
|
||||
params = args.last
|
||||
params[:spec_path] = eval("caller(0)[1]", example_group_block) unless params[:spec_path]
|
||||
if params[:shared]
|
||||
SharedExampleGroup.new(*args, &example_group_block)
|
||||
options = args.last
|
||||
options[:spec_path] = eval("caller(0)[1]", example_group_block) unless options[:spec_path]
|
||||
if options[:shared]
|
||||
create_shared_example_group(args, example_group_block)
|
||||
else
|
||||
self.subclass("Subclass") do
|
||||
describe(*args)
|
||||
module_eval(&example_group_block)
|
||||
end
|
||||
create_nested_example_group(args, example_group_block)
|
||||
end
|
||||
else
|
||||
set_description(*args)
|
||||
before_eval
|
||||
self
|
||||
end
|
||||
end
|
||||
alias :context :describe
|
||||
|
||||
|
||||
def create_shared_example_group(args, example_group_block)
|
||||
SharedExampleGroup.new(*args, &example_group_block)
|
||||
end
|
||||
|
||||
def create_nested_example_group(args, example_group_block)
|
||||
self.subclass("Subclass") do
|
||||
describe(*args)
|
||||
module_eval(&example_group_block)
|
||||
end
|
||||
end
|
||||
|
||||
# Use this to pull in examples from shared example groups.
|
||||
# See Spec::Runner for information about shared example groups.
|
||||
def it_should_behave_like(shared_example_group)
|
||||
|
|
@ -103,21 +110,24 @@ module Spec
|
|||
@predicate_matchers ||= {:an_instance_of => :is_a?}
|
||||
end
|
||||
|
||||
# Creates an instance of Spec::Example::Example and adds
|
||||
# it to a collection of examples of the current example group.
|
||||
def it(description=nil, &implementation)
|
||||
e = new(description, &implementation)
|
||||
# Creates an instance of the current example group class and adds it to
|
||||
# a collection of examples of the current example group.
|
||||
def example(description=nil, options={}, &implementation)
|
||||
e = new(description, options, &implementation)
|
||||
example_objects << e
|
||||
e
|
||||
end
|
||||
|
||||
alias_method :specify, :it
|
||||
alias_method :it, :example
|
||||
alias_method :specify, :example
|
||||
|
||||
# Use this to temporarily disable an example.
|
||||
def xit(description=nil, opts={}, &block)
|
||||
def xexample(description=nil, opts={}, &block)
|
||||
Kernel.warn("Example disabled: #{description}")
|
||||
end
|
||||
alias_method :xspecify, :xit
|
||||
|
||||
alias_method :xit, :xexample
|
||||
alias_method :xspecify, :xexample
|
||||
|
||||
def run
|
||||
examples = examples_to_run
|
||||
|
|
@ -171,7 +181,7 @@ module Spec
|
|||
def examples #:nodoc:
|
||||
examples = example_objects.dup
|
||||
add_method_examples(examples)
|
||||
rspec_options.reverse ? examples.reverse : examples
|
||||
Spec::Runner.options.reverse ? examples.reverse : examples
|
||||
end
|
||||
|
||||
def number_of_examples #:nodoc:
|
||||
|
|
@ -252,11 +262,11 @@ module Spec
|
|||
|
||||
def register(®istration_binding_block)
|
||||
@registration_binding_block = registration_binding_block
|
||||
rspec_options.add_example_group self
|
||||
Spec::Runner.options.add_example_group self
|
||||
end
|
||||
|
||||
def unregister #:nodoc:
|
||||
rspec_options.remove_example_group self
|
||||
Spec::Runner.options.remove_example_group self
|
||||
end
|
||||
|
||||
def registration_backtrace
|
||||
|
|
@ -278,8 +288,8 @@ module Spec
|
|||
private
|
||||
def dry_run(examples)
|
||||
examples.each do |example|
|
||||
rspec_options.reporter.example_started(example)
|
||||
rspec_options.reporter.example_finished(example)
|
||||
Spec::Runner.options.reporter.example_started(example)
|
||||
Spec::Runner.options.reporter.example_finished(example)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
|
@ -302,7 +312,7 @@ module Spec
|
|||
|
||||
after_all_instance_variables = instance_variables
|
||||
examples.each do |example_group_instance|
|
||||
success &= example_group_instance.execute(rspec_options, instance_variables)
|
||||
success &= example_group_instance.execute(Spec::Runner.options, instance_variables)
|
||||
after_all_instance_variables = example_group_instance.instance_variable_hash
|
||||
end
|
||||
return [success, after_all_instance_variables]
|
||||
|
|
@ -335,15 +345,15 @@ module Spec
|
|||
end
|
||||
|
||||
def specified_examples
|
||||
rspec_options.examples
|
||||
Spec::Runner.options.examples
|
||||
end
|
||||
|
||||
def reporter
|
||||
rspec_options.reporter
|
||||
Spec::Runner.options.reporter
|
||||
end
|
||||
|
||||
def dry_run?
|
||||
rspec_options.dry_run
|
||||
Spec::Runner.options.dry_run
|
||||
end
|
||||
|
||||
def example_objects
|
||||
|
|
@ -398,7 +408,7 @@ module Spec
|
|||
case scope
|
||||
when :each; before_each_parts
|
||||
when :all; before_all_parts
|
||||
when :suite; rspec_options.before_suite_parts
|
||||
when :suite; Spec::Runner.options.before_suite_parts
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -406,13 +416,10 @@ module Spec
|
|||
case scope
|
||||
when :each; after_each_parts
|
||||
when :all; after_all_parts
|
||||
when :suite; rspec_options.after_suite_parts
|
||||
when :suite; Spec::Runner.options.after_suite_parts
|
||||
end
|
||||
end
|
||||
|
||||
def before_eval
|
||||
end
|
||||
|
||||
def add_method_examples(examples)
|
||||
instance_methods.sort.each do |method_name|
|
||||
if example_method?(method_name)
|
||||
|
|
|
|||
|
|
@ -5,11 +5,6 @@ module Spec
|
|||
extend ModuleReopeningFix
|
||||
include ModuleInclusionWarnings
|
||||
|
||||
|
||||
PENDING_EXAMPLE_BLOCK = lambda {
|
||||
raise Spec::Example::ExamplePendingError.new("Not Yet Implemented")
|
||||
}
|
||||
|
||||
def execute(options, instance_variables)
|
||||
options.reporter.example_started(self)
|
||||
set_instance_variables_from_hash(instance_variables)
|
||||
|
|
@ -18,7 +13,7 @@ module Spec
|
|||
Timeout.timeout(options.timeout) do
|
||||
begin
|
||||
before_example
|
||||
run_with_description_capturing
|
||||
eval_block
|
||||
rescue Exception => e
|
||||
execution_error ||= e
|
||||
end
|
||||
|
|
@ -63,7 +58,11 @@ module Spec
|
|||
end
|
||||
|
||||
def description
|
||||
@_defined_description || @_matcher_description || "NO NAME"
|
||||
@_defined_description || ::Spec::Matchers.generated_description || "NO NAME"
|
||||
end
|
||||
|
||||
def options
|
||||
@_options
|
||||
end
|
||||
|
||||
def __full_description
|
||||
|
|
@ -79,13 +78,8 @@ module Spec
|
|||
end
|
||||
end
|
||||
|
||||
def run_with_description_capturing
|
||||
begin
|
||||
return instance_eval(&(@_implementation || PENDING_EXAMPLE_BLOCK))
|
||||
ensure
|
||||
@_matcher_description = Spec::Matchers.generated_description
|
||||
Spec::Matchers.clear_generated_description
|
||||
end
|
||||
def eval_block
|
||||
instance_eval(&@_implementation)
|
||||
end
|
||||
|
||||
def implementation_backtrace
|
||||
|
|
@ -109,4 +103,4 @@ module Spec
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ module Spec
|
|||
end
|
||||
end
|
||||
|
||||
def respond_to?(sym)
|
||||
# NOTE - we don't need the second arg, but extenders do: http://www.ruby-doc.org/core/classes/Object.html#M000604
|
||||
def respond_to?(sym, include_private_data=false)
|
||||
MethodDispatcher.new(self.class.described_module).respond_to?(sym) ? true : super
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue