timeframe 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/CHANGELOG +6 -0
- data/lib/timeframe.rb +0 -4
- data/lib/timeframe/version.rb +1 -1
- data/test/test_timeframe.rb +6 -5
- metadata +1 -1
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
data/lib/timeframe.rb
CHANGED
data/lib/timeframe/version.rb
CHANGED
data/test/test_timeframe.rb
CHANGED
@@ -275,7 +275,7 @@ describe Timeframe do
|
|
275
275
|
end
|
276
276
|
it 'understands JSON' do
|
277
277
|
json =<<-EOS
|
278
|
-
2009-05-01/2009-06-01
|
278
|
+
"2009-05-01/2009-06-01"
|
279
279
|
EOS
|
280
280
|
Timeframe.parse(json).must_equal Timeframe.new(:year => 2009, :month => 5)
|
281
281
|
end
|
@@ -286,13 +286,14 @@ EOS
|
|
286
286
|
end
|
287
287
|
end
|
288
288
|
|
289
|
-
describe '#
|
289
|
+
describe '#as_json' do
|
290
290
|
it 'should generate JSON (test fails on ruby 1.8)' do
|
291
|
-
Timeframe.new(:year => 2009).
|
291
|
+
Timeframe.new(:year => 2009).as_json.must_equal %{2009-01-01/2010-01-01}
|
292
|
+
MultiJson.dump(Timeframe.new(:year => 2009)).must_equal Timeframe.new(:year => 2009).as_json.inspect
|
292
293
|
end
|
293
|
-
it 'understands its own
|
294
|
+
it 'understands its own JSON' do
|
294
295
|
t = Timeframe.new(:year => 2009, :month => 5)
|
295
|
-
Timeframe.from_json(t
|
296
|
+
Timeframe.from_json(MultiJson.dump(t)).must_equal t
|
296
297
|
end
|
297
298
|
end
|
298
299
|
|