outlook_importer 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{outlook_importer}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Frank Pr\303\266\303\237dorf, Thilo Utke"]
data/outlook_importer.rb CHANGED
@@ -9,9 +9,10 @@ class OutlookImporter
9
9
  end
10
10
  end
11
11
 
12
- def read(file_path)
13
- separator = File.new(file_path).gets.match(/([,;])[^,;]+\n/)[1]
14
- @csv = FasterCSV.read(file_path, :headers => true, :col_sep => separator)
12
+ def read(file_or_path)
13
+ file = file_or_path.respond_to?(:path) ? file_or_path : File.new(file_or_path)
14
+ separator = file.gets.match(/([,;])[^,;]+\n/)[1]
15
+ @csv = FasterCSV.read(file.path, :headers => true, :col_sep => separator)
15
16
  @mapping = find_lookup_table.invert unless @mapping
16
17
  assign_header_columns(@csv.headers)
17
18
  end
@@ -38,6 +38,13 @@ class OutlookImporterTest < Test::Unit::TestCase
38
38
  assert_equal importer.contacts.first, ["Robin Example", "robin@example.de"]
39
39
  end
40
40
 
41
+ def test_read_from_a_file
42
+ importer = OutlookImporter.new
43
+ importer.read(File.new('livemail_de.csv'))
44
+
45
+ assert_equal importer.contacts.first, ["Robin Example", "robin@example.de"]
46
+ end
47
+
41
48
  def test_initilize_raise_invalid_argument_error_if_lookup_not_satisfied
42
49
  assert_raise ArgumentError do
43
50
  importer = OutlookImporter.new(:firstname => '', :lastname => '', :email => '')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outlook_importer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Frank Pr\xC3\xB6\xC3\x9Fdorf, Thilo Utke"