Skip to content

Commit

Permalink
using rspec 2.0.0.a9
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarobp authored and cavalle committed Feb 28, 2010
1 parent 4a2292e commit 323af02
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
7 changes: 4 additions & 3 deletions Rakefile
@@ -1,13 +1,14 @@
require 'rake'
require 'rake/rdoctask'
require 'spec/rake/spectask'
require 'rspec/core'
require 'rspec/core/rake_task'

desc 'Default: run specs.'
task :default => :spec

desc 'Run specs for the steak plugin.'
Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_files = FileList["spec/**/*_spec.rb"]
Rspec::Core::RakeTask.new(:spec) do |t|
t.pattern = FileList["spec/**/*_spec.rb"]
end

desc 'Generate documentation for the steak plugin.'
Expand Down
22 changes: 12 additions & 10 deletions lib/steak.rb
@@ -1,25 +1,27 @@
require 'rubygems'
require 'spec'
require 'rspec'

module Spec::Example::ExampleGroupMethods
alias scenario example
alias background before
class Rspec::Core::ExampleGroup
class << self
alias scenario example
alias background before
end
end

module Spec::DSL::Main
module Rspec::Core::KernelExtensions
alias feature describe
end

if defined?(Spec::Rails)
if defined?(Rspec::Rails)

module Spec::Rails::Example
module Rspec::Rails::Example
class AcceptanceExampleGroup < IntegrationExampleGroup
include ActionController::RecordIdentifier
Spec::Example::ExampleGroupFactory.register(:acceptance, self)
Rspec::Example::ExampleGroupFactory.register(:acceptance, self)

def method_missing(sym, *args, &block)
return Spec::Matchers::Be.new(sym, *args) if sym.to_s =~ /^be_/
return Spec::Matchers::Has.new(sym, *args) if sym.to_s =~ /^have_/
return Rspec::Matchers::Be.new(sym, *args) if sym.to_s =~ /^be_/
return Rspec::Matchers::Has.new(sym, *args) if sym.to_s =~ /^have_/
super
end
end
Expand Down
12 changes: 7 additions & 5 deletions spec/acceptance/acceptance_helper.rb
@@ -1,5 +1,5 @@
require 'rubygems'
require 'spec'
require 'rspec'
require File.dirname(__FILE__) + "/../../lib/steak"
require 'tempfile'

Expand All @@ -17,8 +17,8 @@ def create_rails_app(options = {})
path = Dir.tmpdir + "rails_app_#{String.random}"
FileUtils.rm_rf path
`rails #{path}`
File.open(path + "/config/environments/test.rb", "a") do |file|
file.write "\nconfig.gem 'rspec-rails', :lib => false\n"
File.open(path + "Gemfile", "a") do |file|
file.write "\ngem 'rspec-rails', '>= 2.0.0.a9'\n"
end
FileUtils.cp_r File.dirname(__FILE__) + "/../../", path + "/vendor/plugins/steak"

Expand Down Expand Up @@ -47,5 +47,7 @@ def self.random(size = 8)
end
end

Spec::Runner.configuration.include(Factories)
Spec::Runner.configuration.include(HelperMethods)
Rspec.configure do |config|
config.include(Factories)
config.include(HelperMethods)
end
2 changes: 1 addition & 1 deletion spec/acceptance/basic_spec.rb
Expand Up @@ -8,7 +8,7 @@

scenario "Minimal acceptance spec" do
spec_file = create_spec <<-SPEC
require '#{File.dirname(__FILE__) + "/../../lib/steak"}'
require '#{File.dirname(__FILE__) + "/../../lib/steak"}'
feature "Minimal spec" do
scenario "First scenario" do
true.should be_true
Expand Down

0 comments on commit 323af02

Please sign in to comment.