Skip to content
Browse files

CHORE: Some code refactorings

  • Loading branch information...
1 parent fff5534 commit 9212b5e1165f679eec411bcb17636b82422a189d @rudionrails committed
Showing with 11 additions and 11 deletions.
  1. +2 −1 Gemfile
  2. +1 −1 lib/yell/adapters/base.rb
  3. +2 −6 lib/yell/level.rb
  4. +1 −1 lib/yell/logger.rb
  5. +5 −2 spec/spec_helper.rb
View
3 Gemfile
@@ -6,7 +6,8 @@ gemspec
group :development, :test do
gem "rake"
- gem "rspec"
+ gem 'rspec-core'
+ gem 'rspec-expectations'
gem "rr"
gem "timecop"
View
2 lib/yell/adapters/base.rb
@@ -166,7 +166,7 @@ def close
# Get a pretty string representation of the adapter, including
def inspect
- inspection = inspectables.inject( [] ) { |r, c| r << "#{c}: #{send(c).inspect}" }
+ inspection = inspectables.map { |m| "#{m}: #{send(m).inspect}" }
"#<#{self.class.name} #{inspection * ', '}>"
end
View
8 lib/yell/level.rb
@@ -140,12 +140,8 @@ def to_i
# Get a pretty string representation of the level, including the severities.
def inspect
- severities = Yell::Severities.each.with_index.inject( [] ) do |r, (l, i)|
- r << l if @severities[i]
- r
- end
-
- "#<#{self.class.name} severities: #{severities * ', '}>"
+ inspectables = Yell::Severities.delete_if.with_index { |l, i| !@severities[i] }
+ "#<#{self.class.name} severities: #{inspectables * ', '}>"
end
View
2 lib/yell/logger.rb
@@ -160,7 +160,7 @@ def #{name}( *m, &b ) # def info( *m, &b )
# Get a pretty string representation of the logger.
def inspect
- inspection = inspectables.inject( [] ) { |r, c| r << "#{c}: #{send(c).inspect}" }
+ inspection = inspectables.map { |m| "#{m}: #{send(m).inspect}" }
"#<#{self.class.name} #{inspection * ', '}, adapters: #{@adapters.map(&:inspect) * ', '}>"
end
View
7 spec/spec_helper.rb
@@ -3,7 +3,8 @@
ENV['YELL_ENV'] = 'test'
-require 'rspec'
+require 'rspec/core'
+require 'rspec/expectations'
require 'rr'
require 'timecop'
@@ -16,7 +17,9 @@
Coveralls::SimpleCov::Formatter
]
- SimpleCov.start
+ SimpleCov.start do
+ add_filter 'spec'
+ end
rescue LoadError
STDERR.puts "Not running coverage..."
end

0 comments on commit 9212b5e

Please sign in to comment.
Something went wrong with that request. Please try again.