Skip to content

Commit

Permalink
Remove cargo-culted LoadError rescues
Browse files Browse the repository at this point in the history
  • Loading branch information
kytrinyx committed Aug 16, 2012
1 parent f104d15 commit 6335c22
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 64 deletions.
42 changes: 8 additions & 34 deletions 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]
35 changes: 5 additions & 30 deletions 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

0 comments on commit 6335c22

Please sign in to comment.