Skip to content

Commit

Permalink
Upgrades RSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
jschementi committed Jun 19, 2008
1 parent 4815ea7 commit 9a81a71
Show file tree
Hide file tree
Showing 290 changed files with 3,069 additions and 11,901 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -4,3 +4,5 @@
.DS_Store
/db/schema.rb
/public/client.xap
/vendor/plugins/rspec*/.git*

4 changes: 3 additions & 1 deletion app/controllers/tutor/class_assignment_controller.rb 100644 → 100755
Expand Up @@ -6,6 +6,8 @@ class Tutor::ClassAssignmentController < Tutor::DefaultController
Tutor.enable :with => :all, :resume => :assistment
include Tutor

client :begin

def list
@assistments = Assistment.find(:all)
end
Expand All @@ -14,4 +16,4 @@ def begin
begin_assistment(Assistment.find(params[:id]))
end

end
end
2 changes: 1 addition & 1 deletion config/environment.rb
Expand Up @@ -24,7 +24,7 @@
# in vendor/plugins are loaded in alphabetical order.
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
config.plugins = [:in_place_editing, :acts_as_list, :silverline]
config.plugins = [:rspec, :"rspec-rails", :in_place_editing, :acts_as_list, :silverline]

# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{RAILS_ROOT}/extras )
Expand Down
20 changes: 20 additions & 0 deletions log/test.log
@@ -0,0 +1,20 @@
Silverline: Generating client.xap
Silverline: Generating client.xap
Silverline: Generating client.xap
Silverline: Generating client.xap
Silverline: Generating client.xap
Silverline: Generating client.xap
Silverline: Generating client.xap
Silverline: Generating client.xap
Silverline: Generating client.xap

***** Debugger requested, but was not available: Start server with --debugger to enable *****
Silverline: Generating client.xap

***** Debugger requested, but was not available: Start server with --debugger to enable *****
Silverline: Generating client.xap

***** Debugger requested, but was not available: Start server with --debugger to enable *****
Silverline: Generating client.xap

***** Debugger requested, but was not available: Start server with --debugger to enable *****
File renamed without changes.
20 changes: 17 additions & 3 deletions ...rators/rspec/templates/script/spec_server → script/spec_server 100644 → 100755
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../rspec/lib' # For svn
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
require 'rubygems'
require 'drb/drb'
Expand All @@ -23,20 +22,29 @@ module Spec
active_connections.delete(name)
end
end
end
end

if ActionController.const_defined?(:Dispatcher)
dispatcher = ::ActionController::Dispatcher.new($stdout)
dispatcher.cleanup_application(true)
dispatcher.cleanup_application
elsif ::Dispatcher.respond_to?(:reset_application!)
::Dispatcher.reset_application!
else
raise "Application reloading failed"
end
if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache)
Fixtures.reset_cache
end

::Dependencies.mechanism = :load
require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
load File.dirname(__FILE__) + '/../spec/spec_helper.rb'

if in_memory_database?
load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
ActiveRecord::Migrator.up('db/migrate') # use migrations
end

::Spec::Runner::CommandLine.run(
::Spec::Runner::OptionParser.parse(
argv,
Expand All @@ -45,6 +53,12 @@ module Spec
)
)
end

def in_memory_database?
ENV["RAILS_ENV"] == "test" and
::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and
::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
end
end
end
end
Expand Down
10 changes: 10 additions & 0 deletions spec/controllers/test_rspec_controller_spec.rb
@@ -0,0 +1,10 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe TestRspecController do

#Delete this example and add some real ones
it "should use TestRspecController" do
controller.should be_an_instance_of(TestRspecController)
end

end
11 changes: 11 additions & 0 deletions spec/helpers/test_rspec_helper_spec.rb
@@ -0,0 +1,11 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe TestRspecHelper do

#Delete this example and add some real ones or delete this file
it "should be included in the object returned by #helper" do
included_modules = (class << helper; self; end).send :included_modules
included_modules.should include(TestRspecHelper)
end

end
File renamed without changes.
4 changes: 4 additions & 0 deletions spec/spec.opts
@@ -0,0 +1,4 @@
--colour
--format progress
--loadby mtime
--reverse
9 changes: 9 additions & 0 deletions ...generators/rspec/templates/spec_helper.rb → spec/spec_helper.rb 100644 → 100755
Expand Up @@ -3,6 +3,7 @@
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'spec'
debugger
require 'spec/rails'

Spec::Runner.configure do |config|
Expand All @@ -28,6 +29,10 @@
# If you declare global fixtures, be aware that they will be declared
# for all of your examples, even those that don't use them.
#
# You can also declare which fixtures to use (for example fixtures for test/fixtures):
#
# config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
#
# == Mock Framework
#
# RSpec uses it's own mocking framework by default. If you prefer to
Expand All @@ -36,4 +41,8 @@
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
#
# == Notes
#
# For more information take a look at Spec::Example::Configuration and Spec::Runner
end
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions vendor/plugins/rspec-rails
Submodule rspec-rails added at b563e8
3 changes: 3 additions & 0 deletions vendor/plugins/rspec/.autotest
@@ -0,0 +1,3 @@
Autotest.add_hook :initialize do |at|
at.add_exception("spec/interop/test/unit/resources")
end
45 changes: 45 additions & 0 deletions vendor/plugins/rspec/CHANGES
@@ -1,6 +1,50 @@
== Version 1.1.5 (in git)

* Added additional characters to be escaped in step strings (patch from Jake Cahoon). Closes #417.
* Disable color codes on STDOUT when STDOUT.tty? is false (patch from Tim Pope). Closes #413.
* mock(:null_object=>true) plays nice with HTML (patch from Gerrit Kaiser). Closes #230.
* a step definition with no block is treated as pending
* make sure consolidate_failures only grabs _spec files. Closes #369
* Simplifying ExampleGroupMethods#registration_backtrace. (From Wilson Bilkovich - http://metaclass.org/2008/6/7/calling-in-the-dark)

== Version 1.1.4

Maintenance release.

Note: we've removed the metaclass method from Object. There were some
generated specs that used it, and they will now break. Just replace the
metaclass call with (class << self; self; end) and all will be well.

* added hash_including mock argument matcher. Closes #332 (patch from Rick DeNatale)
* pending steps print out yellow in stories (patch from Kyle Hargraves)
* Deprecation warnings for specs that assume auto-inclusion of modules. Closes #326 (patch from Scott Taylor)
* mock.should_not_receive(:anything) fails fast (once again)
* Patch from Antti Tarvainen to stop files from being loaded repeatedly when running heckle. Closes #333.
* Fixed bug in which session object in example was not the same instance used in the controller. Closes #331.
* Applied patch from Antti Tarvainen to fix bug where heckle runs rspec runs heckle runs rspec etc. Closes #280.
* Applied patch from Zach Dennis to merge :steps functionality to :steps_for. Closes #324.
* Applied patch from Ryan Davis to add eval of block passed to raise_error matcher. Closes #321.
* alias :context :describe in example_group_methods. Closes #312.
* Applied patch from Ben Mabey to make the Story runner exit with a non-0 exit code on failing stories. Closes #228.
* Applied patch from Coda Hale to get the :red hook called in autotest. Closes #279.
* Applied patch from Patrick Ritchie to support --drb in spec.opts. Closes #274, #293.
* Moved metaclass method from Object to an internal module which gets included where it is needed.
* Applied patch from Dayo Esho: and_yield clobbers return value from block. Closes #217.
* Applied patch from Bob Cotton: ExampleGroupFactory.default resets previously registered types. Closes #222.
* Applied patch from Mike Williams to support the lib directory in rails apps with the Textmate Alternate File command. Closes #276.
* ExampleGroupMethods#xspecify aliases #xit
* A SharedExampleGroup can be created within another ExampleGroup.
* Applied patch from Bob Cotton: Nested ExampleGroups do not have a spec_path. Closes #224.
* Add before_suite and after_suite callbacks to ExampleGroupMethods and Options. Closes #210.
* The after(:suite) callback lambda is passed a boolean representing whether the suite passed or failed
* Added NestedTextFormatter. Closes #366.
* decoupled mock framework from global extensions used by rspec - supports use of flexmock or mocha w/ rails
* Applied patch from Roman Chernyatchik to allow the user to pass in the ruby version into spectask. Closes #325, #370

== Version 1.1.3

Maintenance release.
Notice to autotest users: you must also upgrade to ZenTest-3.9.0.

* Tightened up exceptions list in autotest/rails_spec. Closes #264.
* Applied patch from Ryan Davis for ZenTest-3.9.0 compatibility
Expand All @@ -18,6 +62,7 @@ Maintenance release.
== Version 1.1.2

Minor bug fixes/enhancements.
Notice to autotest users: you must also upgrade to ZenTest-3.8.0.

* RSpec's Autotest subclasses compatible with ZenTest-3.8.0 (thanks to Ryan Davis for making it easier on Autotest subs).
* Applied patch from idl to add spec/lib to rake stats. Closes #226.
Expand Down
2 changes: 1 addition & 1 deletion vendor/plugins/rspec/MIT-LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2005-2007 The RSpec Development Team
Copyright (c) 2005-2008 The RSpec Development Team

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
53 changes: 9 additions & 44 deletions vendor/plugins/rspec/README
Expand Up @@ -5,9 +5,9 @@ with Executable Scenarios and Executable Examples at the code level.

RSpec ships with several modules:

Spec::Story provides a framework for expressing User Stories
Spec::Story provides a framework for expressing User Stories and Scenarios

Spec::Example provides a framework for expressing code Examples
Spec::Example provides a framework for expressing Isolated Examples

Spec::Matchers provides Expression Matchers for use with Spec::Expectations
and Spec::Mocks.
Expand All @@ -22,50 +22,15 @@ behaviour to your existing objects.

== Installation

The simplest approach is to install the gem:
The simplest approach is to install the gem (as root in some environments):

gem install -r rspec #mac users must sudo
gem install -r rspec

== Building the RSpec gem
If you prefer to build the gem locally, check out source from svn://rubyforge.org/var/svn/rspec/trunk. Then
do the following:

rake gem
gem install pkg/rspec-0.x.x.gem (you may have to sudo)

== Running RSpec's specs
In order to run RSpec's full suite of specs (rake pre_commit) you must install the following gems:

* rake # Runs the build script
* rcov # Verifies that the code is 100% covered by specs
* webby # Generates the static HTML website
* syntax # Required to highlight ruby code
* diff-lcs # Required if you use the --diff switch
* win32console # Required by the --colour switch if you're on Windows
* meta_project # Required in order to make releases at RubyForge
* heckle # Required if you use the --heckle switch
* hpricot # Used for parsing HTML from the HTML output formatter in RSpec's own specs

Once those are all installed, you should be able to run the suite with the following steps:

* svn co svn://rubyforge.org/var/svn/rspec/trunk rspec
* cd rspec
* rake install_dependencies
* cd example_rails_app
* export RSPEC_RAILS_VERSION=1.2.3
* rake rspec:generate_mysql_config
* mysql -u root < db/mysql_setup.sql
* cd ..
* rake pre_commit

Note that RSpec itself - once built - doesn't have any dependencies outside the Ruby core
and stdlib - with a few exceptions:

* The spec command line uses diff-lcs when --diff is specified.
* The spec command line uses heckle when --heckle is specified.
* The Spec::Rake::SpecTask needs RCov if RCov is enabled in the task.

See http://rspec.rubyforge.org for further documentation.

== Contributing
If you prefer to build the gem locally:

git clone git://github.com/dchelimsky/rspec.git
cd rspec
rake gem
gem install pkg/rspec-0.x.x.gem #as root

0 comments on commit 9a81a71

Please sign in to comment.