Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove cargo-culted LoadError rescues
- Loading branch information
Showing
2 changed files
with
13 additions
and
64 deletions.
There are no files selected for viewing
42 changes: 8 additions & 34 deletions
42
lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |