This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
/
parameter_spec.rb
42 lines (35 loc) · 1.58 KB
/
parameter_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require 'spec_helper'
describe Versionist::VersioningStrategy::Parameter do
it "should raise an ArgumentError if :parameter is not specified" do
lambda {
Versionist::VersioningStrategy::Parameter.new({})
}.should raise_error(ArgumentError, /you must specify :parameter in the configuration Hash/)
end
it "should raise an ArgumentError if :value is not specified" do
lambda {
Versionist::VersioningStrategy::Parameter.new({:parameter => "version"})
}.should raise_error(ArgumentError, /you must specify :value in the configuration Hash/)
end
context "==" do
before :each do
@parameter = Versionist::VersioningStrategy::Parameter.new({:parameter => "version", :value => "1"})
@equal_parameter = Versionist::VersioningStrategy::Parameter.new({:parameter => "version", :value => "1"})
end
it "should return true if passed an equal object" do
(@parameter == @equal_parameter).should == true
end
it "should return false if passed an object that's not a Versionist::VersioningStrategy::Parameter" do
(@parameter == Array.new).should == false
end
it "should return false if passed an object that's not equal" do
@unequal_parameter = Versionist::VersioningStrategy::Parameter.new({:parameter => "ver", :value => "1"})
(@parameter == @unequal_parameter).should == false
end
it "should find equal versioning strategies via Array.include?" do
@array = Array.new
@array << @parameter
@array.include?(@parameter).should == true
@array.include?(@equal_parameter).should == true
end
end
end