Sha256: c5488ae90682071d5f0ba1515be7c1a3f7eb0a332825aead669ce02314f0abbd
Contents?: true
Size: 969 Bytes
Versions: 1
Compression:
Stored size: 969 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.3 | test/test_copyright.rb |