Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
philostler committed Nov 13, 2011
1 parent 8e58c27 commit 67c3b91
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/poros/run_strategy_spec.rb
@@ -0,0 +1,15 @@
require "spec_helper"

describe Alloy::Poros::RunStrategy do
subject { described_class.new nil, nil }

it { subject.should allow_public_access_for_methods :now }

describe "#now" do
it "should invoke formed_strategy" do
subject.should_receive(:strategy_formed).once

subject.now
end
end
end
36 changes: 36 additions & 0 deletions spec/poros/schedule_strategy_spec.rb
@@ -0,0 +1,36 @@
require "spec_helper"

describe Alloy::Poros::ScheduleStrategy do
subject { described_class.new nil, nil }

it { subject.should allow_public_access_for_methods :every }

describe "#every" do
it "should return the every duration" do
subject.should_receive(:strategy_formed).once
subject.every 5

subject.every.should be 5
end

context "when a duration is specified" do
it "should set the every duration" do
subject.should_receive(:strategy_formed).once
subject.every 7

subject.every.should be 7
end
it "should invoke formed_strategy" do
subject.should_receive(:strategy_formed).once

subject.every 9
end

context "when duration is less than one" do
it "should raise an argument error" do
expect { subject.every 0 }.to raise_error ArgumentError, "an 'every' duration cannot be less than 1"
end
end
end
end
end
38 changes: 38 additions & 0 deletions spec/poros/strategy_spec.rb
@@ -0,0 +1,38 @@
require "spec_helper"

describe Alloy::Poros::Strategy do
subject { described_class.new Class, nil }

it { subject.should allow_public_access_for_methods :clazz, :in }

describe "#clazz" do
it "should return the clazz" do
subject.clazz.should be Class
end
end

describe "#in" do
it "should return the in duration" do
subject.in 5

subject.in.should be 5
end

context "when a duration is specified" do
it "should set the in duration" do
subject.in 7

subject.in.should be 7
end
it "should return itself" do
subject.in(9).should be subject
end

context "when duration is less than one" do
it "should raise an argument error" do
expect { subject.in 0 }.to raise_error ArgumentError, "an 'in' duration cannot be less than 1"
end
end
end
end
end

0 comments on commit 67c3b91

Please sign in to comment.