Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jon Stroop
committed
Jan 22, 2015
1 parent
6d37da7
commit 065b84b
Showing
5 changed files
with
79 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
--color | ||
--require spec_helper | ||
--format documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
x | ||
1 2000-06-08T00:00:00-05:00 2012-05-21T11:40:38-05:00 | ||
2 2000-06-08T00:00:00-05:00 2010-06-16T15:55:32-05:00 | ||
3 2000-06-08T00:00:00-05:00 | ||
4 2000-06-08T00:00:00-05:00 2011-05-04T10:14:46-05:00 | ||
5 2000-06-08T00:00:00-05:00 2013-04-12T13:40:57-05:00 | ||
8 2000-06-08T00:00:00-05:00 2012-07-06T10:21:00-05:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
y | ||
1 2000-06-08T00:00:00-05:00 2012-06-21T11:40:38-05:00 | ||
3 2000-06-08T00:00:00-05:00 | ||
4 2000-06-08T00:00:00-05:00 2011-05-04T10:14:46-05:00 | ||
6 2000-06-08T00:00:00-05:00 2013-04-12T13:40:57-05:00 | ||
8 2000-06-08T00:00:00-05:00 2012-07-06T10:22:00-05:00 | ||
11 2000-06-08T00:00:00-05:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,64 @@ | ||
require 'date' | ||
|
||
describe VoyagerHelpers::SyncFu do | ||
|
||
let(:fixtures_dir) { File.join(File.dirname(__FILE__), '../../fixtures') } | ||
let(:earlier_file) { File.join(fixtures_dir, 'earlier_id_dump.txt') } | ||
let(:later_file) { File.join(fixtures_dir, 'later_id_dump.txt') } | ||
let(:subject) { described_class } | ||
|
||
describe '#compare_id_dumps' do | ||
|
||
it 'sorts the entries as expected' do | ||
now = DateTime.now.new_offset(0) | ||
report = VoyagerHelpers::SyncFu.compare_id_dumps(earlier_file, later_file, now) | ||
expected = { | ||
create: [ | ||
{ | ||
id: '11', | ||
datetime: DateTime.parse('2000-06-08T00:00:00-05:00').new_offset(0) | ||
}, { | ||
id: '6', | ||
datetime: DateTime.parse('2013-04-12T13:40:57-05:0').new_offset(0) | ||
} | ||
], | ||
update: [ | ||
{ | ||
id: '1', | ||
datetime: DateTime.parse('2012-06-21T11:40:38-05:00').new_offset(0) | ||
}, | ||
{ | ||
id: '8', | ||
datetime: DateTime.parse('2012-07-06T10:22:00-05:00').new_offset(0) | ||
} | ||
], | ||
delete: [ | ||
{ id: '2', datetime: now }, | ||
{ id: '5', datetime: now } | ||
] | ||
} | ||
expect(report).to eq expected | ||
end | ||
|
||
it 'does not raise an error if we don\'t supply the time' do | ||
expect { | ||
VoyagerHelpers::SyncFu.compare_id_dumps(earlier_file, later_file) | ||
}.to_not raise_error | ||
end | ||
|
||
it 'will supply a delete date if we don\'t supply the time' do | ||
report = VoyagerHelpers::SyncFu.compare_id_dumps(earlier_file, later_file) | ||
expect(report[:delete][0][:datetime]).to be_a DateTime | ||
end | ||
end | ||
end | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|