This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e58c27
commit 67c3b91
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |