Skip to content

Commit

Permalink
Merge branch 'fix-active-support-clobbering' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Iain Barnett committed Oct 7, 2015
2 parents 2456f61 + 2411be1 commit 311f531
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ group :development do
gem "maruku"
gem "yard"
gem "pry"
gem "activesupport"
end

group :test do
Expand Down
11 changes: 9 additions & 2 deletions lib/tickle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,22 @@
require_relative "ext/date_and_time.rb"
require_relative "ext/string.rb"

# these are required not because they're used by the library
# but because they clobber so much that testing
# without them will miss possible problems
require 'active_support/core_ext/string/conversions'
require 'active_support/core_ext/date/calculations'
require 'active_support/core_ext/date_time/calculations'
require 'active_support/core_ext/time/calculations'

# Tickle is a natural language parser for recurring events.
module Tickle


def self.parse(asked, options = {})
# check to see if a datetime was passed
# if so, give it back
# TODO Consider converting to a Tickled
return tickled if asked.respond_to? :to_time
return asked if asked.respond_to? :day

tickled = Tickled.new asked, options
_parse tickled
Expand Down
8 changes: 8 additions & 0 deletions spec/tickle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ module Tickle # for convenience

describe "parse", :integration => true do

context "Asked with an object that responds to :to_time" do
describe "Returning it immediately" do
let(:expected) { Date.parse("7th October 2015") }
subject{ Tickle.parse(expected) }
it { should == expected }
end
end

context "Simple examples", :frozen => true do

context "second" do
Expand Down

0 comments on commit 311f531

Please sign in to comment.