File: jyear_spec.rb

package info (click to toggle)
tdiary-contrib 5.0.11-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,660 kB
  • sloc: ruby: 17,024; lisp: 546; xml: 451; php: 61; sql: 40; makefile: 18
file content (21 lines) | stat: -rw-r--r-- 497 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# -*- coding: utf-8 -*-

$:.unshift(File.dirname(__FILE__))
require 'spec_helper'
require 'time'

describe "jyear plugin" do
  {
    '1925/01/01' => '昔々',
    '1926/12/25' => '昭和元年',
    '1927/01/01' => '昭和2',
    '1989/01/08' => '平成元年',
    '1990/01/01' => '平成2',
  }.each do |k,v|
    it { expect(setup_jyear_plugin(Time.parse(k)).date.strftime('%K')).to eq(v) }
  end

  def setup_jyear_plugin(date)
    fake_plugin(:jyear) { |plugin| plugin.date = date }
  end
end