Sha256: 30bec0d5cf6f948a624419c85aa390bb9f4b107e2b4cd05dd5a4557e98d7b772
Contents?: true
Size: 971 Bytes
Versions: 1
Compression:
Stored size: 971 Bytes
Contents
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'test_helper' include CopyrightHelper class CopyrightYearTest < Test::Unit::TestCase def setup @today = Date.stubs(:today).returns(Date.civil(2009)) this_year = @today.stubs(:year).returns("2009") end should "raise when an argument is not anumber" do assert_raise(ArgumentError) { copyright_years() } assert_raise(ArgumentError) { copyright_years("123") } assert_nothing_raised { copyright_years(2004) } assert_nothing_raised { copyright_years(2009) } end should "returen the number of 'since' when the 'since' is the year of today" do assert_equal(2009.to_s, @today.year) end should "return 2009 - 2010 when the argument is not the year of 'since'" do years = copyright_years(2006) assert_equal("2006 - 2009", years) end should "raise the argument is bigger than the this year" do assert_raise(ArgumentError) {copyright_years(2220)} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
copyright-0.1.1 | test/test_copyright.rb |