-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Sija/crystal-0.33.0
Refactors and support for Crystal 0.33.0
- Loading branch information
Showing
11 changed files
with
251 additions
and
236 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 |
---|---|---|
@@ -1 +1,17 @@ | ||
language: crystal | ||
|
||
crystal: | ||
- latest | ||
- nightly | ||
|
||
matrix: | ||
allow_failures: | ||
- crystal: nightly | ||
|
||
install: | ||
- shards install | ||
|
||
script: | ||
- crystal spec | ||
- crystal tool format --check | ||
- bin/ameba |
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
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 |
---|---|---|
@@ -1,10 +1,16 @@ | ||
name: timecop | ||
version: 0.3.0 | ||
version: 0.4.0 | ||
|
||
authors: | ||
- TobiasGSmollett <[email protected]> | ||
- robacarp | ||
- Sijawusz Pur Rahnama <[email protected]> | ||
|
||
crystal: 0.29.0 | ||
development_dependencies: | ||
ameba: | ||
github: crystal-ameba/ameba | ||
version: ~> 0.11.0 | ||
|
||
crystal: 0.33.0 | ||
|
||
license: MIT |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
require "spec" | ||
require "../src/timecop" | ||
|
||
def times_effectively_equal(time1, time2, seconds_interval = 1.0) | ||
(time1 - time2).abs.to_f <= seconds_interval | ||
end | ||
Spec.before_each { Timecop.return } | ||
Spec.after_each { Timecop.return } |
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 |
---|---|---|
@@ -1,30 +1,16 @@ | ||
require "./spec_helper" | ||
|
||
describe Timecop do | ||
describe Timecop::TimeStackItem do | ||
it "properly delegates time-related methods" do | ||
time = Time.local(2012, 7, 28, 20, 0) | ||
|
||
it "new_with_time" do | ||
t = Time.now | ||
y, m, d, h, min, s = t.year, t.month, t.day, t.hour, t.minute, t.second | ||
stack_item = Timecop::TimeStackItem.new(:freeze, t) | ||
|
||
true.should eq(y == stack_item.year) | ||
true.should eq(m == stack_item.month) | ||
true.should eq(d == stack_item.day) | ||
true.should eq(h == stack_item.hour) | ||
true.should eq(min == stack_item.minute) | ||
true.should eq(s == stack_item.second) | ||
end | ||
|
||
it "new_with_time_and_arguments" do | ||
t = Time.new(2012, 7, 28, 20, 0) | ||
y, m, d, h, min, s = t.year, t.month, t.day, t.hour, t.minute, t.second | ||
stack_item = Timecop::TimeStackItem.new(:freeze, t) | ||
|
||
true.should eq(y == stack_item.year) | ||
true.should eq(m == stack_item.month) | ||
true.should eq(d == stack_item.day) | ||
true.should eq(h == stack_item.hour) | ||
true.should eq(min == stack_item.minute) | ||
true.should eq(s == stack_item.second) | ||
Timecop::TimeStackItem.new(:freeze, time).tap do |stack_item| | ||
stack_item.year.should eq(time.year) | ||
stack_item.month.should eq(time.month) | ||
stack_item.day.should eq(time.day) | ||
stack_item.hour.should eq(time.hour) | ||
stack_item.minute.should eq(time.minute) | ||
stack_item.second.should eq(time.second) | ||
end | ||
end | ||
end |
Oops, something went wrong.