Skip to content
This repository has been archived by the owner on Mar 28, 2018. It is now read-only.

Commit

Permalink
Including Coveralls and updating spec to be localized
Browse files Browse the repository at this point in the history
  • Loading branch information
golmansax committed Oct 23, 2014
1 parent 313e824 commit e89dbcb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ source 'https://rubygems.org'
gemspec

group :development, :test do
gem 'coveralls'
gem 'rake'
gem 'travis'
gem 'rubocop'
Expand Down
6 changes: 5 additions & 1 deletion lib/stink_bomb/bomb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Bomb

def initialize(datetime)
self.datetime = parse(datetime)
fail fail_message if !production? && DateTime.now > self.datetime
fail fail_message if !production? && past_datetime?
end

def parse(datetime)
Expand All @@ -23,5 +23,9 @@ def fail_message
def production?
ENV['RAILS_ENV'] == 'production' || ENV['RACK_ENV'] == 'production'
end

def past_datetime?
Time.now.getlocal.to_datetime > datetime
end
end
end
2 changes: 1 addition & 1 deletion spec/lib/stink_bomb/bomb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class StinkBomb

it 'does nothing if now + epsilon is given' do
expect do
Bomb.new(Time.now + 1)
Bomb.new(Time.now.getlocal + 1)
end.not_to raise_error
end

Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require 'coveralls'
Coveralls.wear!

require_relative '../lib/stink_bomb'

RSpec.configure do |config|
Expand Down

0 comments on commit e89dbcb

Please sign in to comment.