|
Revision 6635, 0.6 kB
(checked in by hsbt, 10 months ago)
|
|
platform/tdiary/spec: merge from spec_with_rspec-fixture.
|
| Line | |
|---|
| 1 | $:.unshift(File.dirname(__FILE__)) |
|---|
| 2 | require 'spec_helper' |
|---|
| 3 | require 'time' |
|---|
| 4 | |
|---|
| 5 | describe "jyear plugin" do |
|---|
| 6 | with_fixtures :date => :jyear do |
|---|
| 7 | def setup_jyear_plugin(date) |
|---|
| 8 | fake_plugin(:jyear) { |plugin| |
|---|
| 9 | plugin.date = date |
|---|
| 10 | } |
|---|
| 11 | end |
|---|
| 12 | |
|---|
| 13 | it 'in :date' do |date, jyear| |
|---|
| 14 | setup_jyear_plugin(date).date.strftime('%K').should == jyear |
|---|
| 15 | end |
|---|
| 16 | |
|---|
| 17 | filters({ |
|---|
| 18 | :date => lambda {|val| Time.parse(val) }, |
|---|
| 19 | }) |
|---|
| 20 | |
|---|
| 21 | set_fixtures([ |
|---|
| 22 | ['1925/01/01' => '昔々'], |
|---|
| 23 | ['1926/12/25' => '昭和元年'], |
|---|
| 24 | ['1927/01/01' => '昭和2' ], |
|---|
| 25 | ['1989/01/08' => '平成元年' ], |
|---|
| 26 | ['1990/01/01' => '平成2' ], |
|---|
| 27 | ]) |
|---|
| 28 | end |
|---|
| 29 | end |
|---|