From 6335c227126e0d9ea46f6e7723652cca49f9e1b9 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Thu, 16 Aug 2012 15:14:01 +0200 Subject: [PATCH] Remove cargo-culted LoadError rescues --- .../rspec/templates/tasks/rspec.rake | 42 ++++--------------- tasks/rspec.rake | 35 +++------------- 2 files changed, 13 insertions(+), 64 deletions(-) diff --git a/lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake b/lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake index 33c63d1..c50aa5b 100644 --- a/lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake +++ b/lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake @@ -1,37 +1,11 @@ -begin - require 'rspec' -rescue LoadError - begin - require 'rubygems' - require 'rspec' - rescue LoadError - puts <<-EOS -To use rspec for testing you must install rspec gem: +require 'rspec' +require 'rspec/core/rake_task' - gem install rspec - -or add it to your Gemfile and install it: - - echo "gem 'rspec'" >> Gemfile - bundle install - -EOS - exit 1 - end +desc "Run the specs under spec/" +RSpec::Core::RakeTask.new do |t| + t.rspec_opts = ['--options', "spec/spec.opts"] end -begin - require 'rspec/core/rake_task' - - desc "Run the specs under spec/" - RSpec::Core::RakeTask.new do |t| - t.rspec_opts = ['--options', "spec/spec.opts"] - end - - # Want other tests/tasks run by default? - # Add them to the list - task :default => [:spec] #, :features] - -rescue LoadError, NameError - puts "Unable to define the rake spec task" -end +# Want other tests/tasks run by default? +# Add them to the list +task :default => [:spec] #, :features] diff --git a/tasks/rspec.rake b/tasks/rspec.rake index 9a35c62..6754c7c 100644 --- a/tasks/rspec.rake +++ b/tasks/rspec.rake @@ -1,32 +1,7 @@ -begin - require 'rspec' -rescue LoadError - begin - require 'rubygems' - require 'rspec' - rescue LoadError - puts <<-EOS -To use rspec for testing you must install rspec gem: +require 'rspec' +require 'rspec/core/rake_task' - gem install rspec - -or add it to your Gemfile and install it: - - echo "gem 'rspec'" >> Gemfile - bundle install - -EOS - exit 1 - end -end - -begin - require 'rspec/core/rake_task' - - desc "Run the specs under spec/" - RSpec::Core::RakeTask.new do |t| - t.rspec_opts = ['--options', "spec/spec.opts"] - end -rescue LoadError, NameError - puts "Unable to define the rake spec task" +desc "Run the specs under spec/" +RSpec::Core::RakeTask.new do |t| + t.rspec_opts = ['--options', "spec/spec.opts"] end