-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleap_spec.rb
More file actions
54 lines (43 loc) · 1.19 KB
/
leap_spec.rb
File metadata and controls
54 lines (43 loc) · 1.19 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
# We are supposed to use the already generated tests, below, to create code that passes all the tests. Please see other file called "leap.rb" for my code.
gem 'minitest', '>= 5.0.0'
require 'minitest/pride'
require 'minitest/autorun'
require_relative 'leap'
# This Date class can be safely ignored.
# It prevents using the Date class' leap? method.
class Date
def leap?
throw "Implement this yourself instead of using Ruby's implementation."
end
alias_method :gregorian_leap?, :leap?
alias_method :julian_leap?, :leap?
end
describe "Leap Year Test" do
it "Test on 1996" do
skip
expect(leap_year?(1996)).must_equal true
end
it "Checking non leap year" do
skip
expect(leap_year?(1997)).wont_equal true
end
it "Check non leap even year" do
skip
expect(leap_year?(1998)).wont_equal true
end
it "Check century which is not a leap year" do
expect(leap_year?(1900)).wont_equal true
end
it "Check fourth_century" do
skip
expect(leap_year?(2400)).must_equal true
end
it "Check Y2K" do
skip
expect(leap_year?(2000)).must_equal true
end
it "Check very long long ago" do
skip
expect(leap_year?(8)).must_equal true
# end
end