Skip to content

Commit

Permalink
Lower activesupport requirements. Misc ruby 1.8 compatability fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cook committed Feb 8, 2011
1 parent eb15470 commit 896517c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/recurrence/namespace.rb
@@ -1,7 +1,7 @@
require "active_support/core_ext"

require "date"
require "active_support/all"
require "enumerator"

module SimplesIdeias
class Recurrence
autoload :Event, "recurrence/event"
Expand Down
10 changes: 7 additions & 3 deletions recurrence.gemspec
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "recurrence"

require "recurrence"
Gem::Specification.new do |s|
s.name = "recurrence"
s.version = Recurrence::Version::STRING
Expand All @@ -19,7 +19,11 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_dependency "activesupport"
s.add_dependency "activesupport", ">= 2.3.0"
s.add_development_dependency "rspec", ">= 2.0.0"
s.add_development_dependency "ruby-debug19"
if RUBY_VERSION >= "1.9.0"
s.add_development_dependency "ruby-debug19"
else
s.add_development_dependency "ruby-debug"
end
end
6 changes: 4 additions & 2 deletions spec/recurrence_spec.rb
@@ -1,6 +1,8 @@
require "spec_helper"

describe Recurrence do
let(:enumerator_constant){ RUBY_VERSION > "1.9.0" ? Enumerator : Enumerable::Enumerator }

it "should require :every option" do
expect { recurrence({}) }.to raise_error(ArgumentError)
end
Expand All @@ -18,11 +20,11 @@
end

it "should return an enumerator when Recurrence#each is called without a block" do
recurrence(:every => :day).each.should be_instance_of(Enumerator)
recurrence(:every => :day).each.should be_instance_of(enumerator_constant)
end

it "should return an enumerator when Recurrence#each! is called without a block" do
recurrence(:every => :day).each!.should be_instance_of(Enumerator)
recurrence(:every => :day).each!.should be_instance_of(enumerator_constant)
end

Recurrence::Event::Monthly::INTERVALS.each do |interval|
Expand Down

0 comments on commit 896517c

Please sign in to comment.