tests.rb in ruby-version-0.4.2 vs tests.rb in ruby-version-0.4.3
- old
+ new
@@ -1,8 +1,8 @@
#!/usr/bin/env ruby
# encoding: utf-8
-# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
+# (c) 2011-2012 Martin Kozák (martinkozak@martinkozak.net)
$:.push("./lib")
require "rubygems"
require "rspec"
@@ -20,114 +20,113 @@
###
describe Ruby::Engine do
specify "NAME shoud be something reasonable" do
- not ['ruby', 'jruby', 'rbx'].include? Ruby::Engine::NAME
+ ['ruby', 'jruby', 'rbx'].include?(Ruby::Engine::NAME).should be_true
end
it "shoud be comparable" do
- Ruby::Engine == "foo"
- true
+ (Ruby::Engine == "foo").should be_false
end
end
describe Ruby::Version, "-- algebraic comparsion operators" do
context "against higher version" do
it "should be lower" do
- Ruby::Version < HIGHER
+ (Ruby::Version < HIGHER).should be_true
end
it "should be lower or equal" do
- Ruby::Version <= HIGHER
+ (Ruby::Version <= HIGHER).should be_true
end
it "shouldn't be equal" do
- not Ruby::Version == HIGHER
+ (Ruby::Version == HIGHER).should be_false
end
it "should be higher or equal" do
- Ruby::Version >= HIGHER
+ (Ruby::Version >= HIGHER).should be_false
end
it "should be higher" do
- Ruby::Version > HIGHER
+ (Ruby::Version > HIGHER).should be_false
end
end
context "against current version" do
it "shouldn't be lower" do
- not Ruby::Version < CURRENT
+ (Ruby::Version < CURRENT).should be_false
end
it "should be lower or equal" do
- Ruby::Version <= CURRENT
+ (Ruby::Version <= CURRENT).should be_true
end
it "should be equal" do
- Ruby::Version == CURRENT
+ (Ruby::Version == CURRENT).should be_true
end
it "should be higher or equal" do
- Ruby::Version >= CURRENT
+ (Ruby::Version >= CURRENT).should be_true
end
it "shouldn't be higher" do
- not Ruby::Version > HIGHER
+ (Ruby::Version > HIGHER).should be_false
end
end
context "against lower version" do
it "should be lower" do
- Ruby::Version < LOWER
+ (Ruby::Version < LOWER).should be_false
end
it "should be lower or equal" do
- Ruby::Version <= LOWER
+ (Ruby::Version <= LOWER).should be_false
end
it "shouldn't be equal" do
- not Ruby::Version == LOWER
+ (Ruby::Version == LOWER).should be_false
end
it "shouldn't be higher or equal" do
- not Ruby::Version >= LOWER
+ (Ruby::Version >= LOWER).should be_true
end
it "shouldn't be higher" do
- not Ruby::Version > LOWER
+ (Ruby::Version > LOWER).should be_true
end
end
end
describe Ruby::Version, "-- fuzzy operators" do
context "against higher version" do
specify "#<=> should return -1" do
- (Ruby::Version <=> HIGHER) == -1
+ (Ruby::Version <=> HIGHER).should eq(-1)
end
specify "#compare should return -1" do
- Ruby::Version::compare(HIGHER) == -1
+ Ruby::Version::compare(HIGHER).should eq(-1)
end
end
context "against current version" do
specify "#<=> should return 0" do
- (Ruby::Version <=> CURRENT) == 0
+ (Ruby::Version <=> CURRENT).should eq(0)
end
specify "#compare should return 0" do
- Ruby::Version::compare(CURRENT) == 0
+ Ruby::Version::compare(CURRENT).should eq(0)
end
end
context "against lower version" do
specify "#<=> should return 1" do
- (Ruby::Version <=> LOWER) == 1
+ (Ruby::Version <=> LOWER).should eq(1)
end
specify "#compare should return 1" do
- Ruby::Version::compare(LOWER) == -1
+ Ruby::Version::compare(LOWER).should eq(1)
end
end
end
describe Ruby::Version do
specify "TOKENS constant content the same as broking result" do
- Ruby::Version::TOKENS == Ruby::Version::broke(RUBY_VERSION)
+ Ruby::Version::TOKENS.should eq(Ruby::Version::broke(RUBY_VERSION))
end
specify "VERSION constant should be equal to RUBY_VERSION" do
- Ruby::Version::VERSION == RUBY_VERSION
+ Ruby::Version::VERSION.should eq(RUBY_VERSION)
end
specify "broking components should equal to version string components" do
- Ruby::Version::broke("1.2.3") == [1, 2, 3]
+ Ruby::Version::broke("1.2.3").should eq([1, 2, 3])
end
end