Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switch to RSpec 2

Pend one feature while pondering best way to run it; likely after
switching suite to use Rails 3.
  • Loading branch information...
commit a2c802089a7bcdd8e953da01cb383370b727d055 1 parent ba5462b
@mattyoho authored
View
2  .rspec
@@ -0,0 +1,2 @@
+--colour
+--format=documentation
View
19 Gemfile.lock
@@ -61,10 +61,18 @@ GEM
activesupport (= 2.3.5)
rake (>= 0.8.3)
rake (0.8.7)
- rspec (1.3.0)
- rspec-rails (1.3.2)
- rack (>= 1.0.0)
- rspec (>= 1.3.0)
+ rspec (2.0.1)
+ rspec-core (~> 2.0.1)
+ rspec-expectations (~> 2.0.1)
+ rspec-mocks (~> 2.0.1)
+ rspec-core (2.0.1)
+ rspec-expectations (2.0.1)
+ diff-lcs (>= 1.1.2)
+ rspec-mocks (2.0.1)
+ rspec-core (~> 2.0.1)
+ rspec-expectations (~> 2.0.1)
+ rspec-rails (2.0.1)
+ rspec (~> 2.0.0)
ruby-debug (0.10.3)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.3.0)
@@ -96,8 +104,7 @@ DEPENDENCIES
cucumber-rails (= 0.3.2)
database_cleaner (= 0.5.2)
rails (= 2.3.5)
- rspec (= 1.3.0)
- rspec-rails (= 1.3.2)
+ rspec-rails (~> 2.0.1)
ruby-debug (= 0.10.3)
sqlite3-ruby (= 1.3.0)
test-unit (= 1.2.3)
View
16 Rakefile
@@ -1,26 +1,17 @@
begin
- require 'spec/rake/spectask'
+ require 'rspec/core/rake_task'
require 'cucumber/rake/task'
task :default => [:spec, :cucumber]
desc "Run specs"
- Spec::Rake::SpecTask.new do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = %w(--format=progress --color)
+ RSpec::Core::RakeTask.new do |t|
+ t.rspec_opts = %w(--format=progress --color)
end
Cucumber::Rake::Task.new(:cucumber) do |t|
t.cucumber_opts = %w{--format progress}
end
-
- desc "Run specs with rcov"
- Spec::Rake::SpecTask.new(:spec_with_rcov) do |t|
- t.spec_files = FileList['spec/**/*_spec.rb']
- t.spec_opts = %w(-fs --color)
- t.rcov = true
- t.rcov_opts = ['--exclude', 'spec']
- end
rescue LoadError
puts "Warning: RSpec or Cucumber is not installed"
end
@@ -35,7 +26,6 @@ namespace :generate do
system 'rails ./tmp/example_app'
Dir.chdir("./tmp/example_app/") do
system 'script/generate cucumber'
- system 'script/generate rspec'
system 'cp ../../templates/environment.rb ./config/'
system 'cp ../../templates/test.rb ./config/environments/test.rb'
system 'cp ../../templates/custom_steps.rb ./features/step_definitions/'
View
3  basic_assumption.gemspec
@@ -60,8 +60,7 @@ Gem::Specification.new do |s|
s.add_development_dependency("cucumber-rails", ["0.3.2"])
s.add_development_dependency("database_cleaner", ["0.5.2"])
s.add_development_dependency("rails", ["2.3.5"])
- s.add_development_dependency("rspec", ["1.3.0"])
- s.add_development_dependency("rspec-rails", ["1.3.2"])
+ s.add_development_dependency("rspec-rails", ["~> 2.0.1"])
s.add_development_dependency("sqlite3-ruby", ["1.3.0"])
s.add_development_dependency("will_paginate", ["2.3.14"])
end
View
11 features/rspec_matcher_for_assume.feature
@@ -1,22 +1,27 @@
Feature: RSpec Matcher For Assume
+ @wip
Scenario: Controller spec uses the simple matcher
Given a file named "app/controllers/widgets_controller.rb" with:
"""
- class WidgetsController < ApplicationController
+ class BaseController
+ extend BasicAssumption
+ end
+
+ class WidgetsController < BaseController
assume :widget
end
"""
And a file named "spec/controllers/widgets_controller_spec.rb" with:
"""
- require 'spec_helper'
+ require 'app/controllers/widgets_controller'
require 'basic_assumption/rspec'
describe WidgetsController do
it { should assume(:widget) }
it { should_not assume(:sprocket) }
end
"""
- When I run "bundle exec spec spec/controllers/widgets_controller_spec.rb"
+ When I run "bundle exec rspec spec/controllers/widgets_controller_spec.rb"
Then I should see:
"""
2 examples, 0 failures
View
2  spec/spec.opts
@@ -1,2 +0,0 @@
---colour
---format=specdoc
View
8 spec/spec_helper.rb
@@ -10,10 +10,16 @@ def next_subclass_id
extend self
end
-Spec::Example::ExampleGroup.class_eval do
+module BasicAssumptionSpecHelpers
def named_class_extending(base)
extender = Class.new(base)
subclass_name = "Subclass_#{SubclassContainer.next_subclass_id}_#{base.name.gsub(/:+/, '_')}"
SubclassContainer.const_set subclass_name, extender
end
end
+
+RSpec.configure do |config|
+ config.include(BasicAssumptionSpecHelpers)
+
+ config.mock_with :rspec
+end
Please sign in to comment.
Something went wrong with that request. Please try again.