datashift 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -55,7 +55,7 @@ describe 'PaperClip Bulk Loader' do
55
55
  loader.attach_to_klass.should == Owner
56
56
  end
57
57
 
58
- it "should bulk load from a directory file system", :fail => true do
58
+ it "should bulk load from a directory file system" do
59
59
 
60
60
  # these names should be included in the attachment file name somewhere
61
61
  ["DEMO_001", "DEMO_002", "DEMO_003", "DEMO_004"].each do |n|
@@ -0,0 +1,94 @@
1
+ # Copyright:: (c) Autotelik Media Ltd 2011
2
+ # Author :: Tom Statter
3
+ # Date :: Aug 2011
4
+ # License:: MIT
5
+ #
6
+ # Details:: Specs for base class Loader
7
+ #
8
+ require File.dirname(__FILE__) + '/spec_helper'
9
+
10
+ require 'erb'
11
+
12
+ describe 'Populator' do
13
+
14
+ include_context "ActiveRecordTestModelsConnected"
15
+
16
+ include_context "ClearAndPopulateProject"
17
+
18
+ before(:each) do
19
+ @loader = DataShift::LoaderBase.new(Project)
20
+
21
+ @populator = DataShift::Populator.new
22
+
23
+ end
24
+
25
+ it "should be able to create a new populator" do
26
+ local_populator = DataShift::Populator.new
27
+ local_populator.should_not be_nil
28
+ end
29
+
30
+
31
+ it "should be able to create and assign populator as string to loader" do
32
+
33
+ class AnotherPopulator
34
+ end
35
+
36
+ options = {:populator => 'AnotherPopulator' }
37
+
38
+ local_loader = DataShift::LoaderBase.new(Project, true, nil, options)
39
+
40
+ local_loader.populator.should_not be_nil
41
+ local_loader.populator.should be_a AnotherPopulator
42
+ end
43
+
44
+ it "should be able to create and assign populator as class to loader" do
45
+
46
+ class AnotherPopulator
47
+ end
48
+
49
+ options = {:populator => AnotherPopulator }
50
+
51
+ local_loader = DataShift::LoaderBase.new(Project, true, nil, options)
52
+
53
+ local_loader.populator.should_not be_nil
54
+ local_loader.populator.should be_a AnotherPopulator
55
+ end
56
+
57
+ it "should process a string value against an assigment column" do
58
+
59
+ column_heading = 'Value As String'
60
+ value = 'Another Lazy fox '
61
+
62
+ method_detail = DataShift::MethodDictionary.find_method_detail( Project, column_heading )
63
+
64
+ method_detail.should_not be_nil
65
+
66
+ x, attributes = @populator.prepare_data(method_detail, value)
67
+
68
+ x.should == value
69
+ attributes.should be_a Hash
70
+ attributes.should be_empty
71
+
72
+ end
73
+
74
+ it "should process a string value against an assigment instance method" do
75
+
76
+ value = 'Get up Lazy fox '
77
+
78
+ DataShift::MethodDictionary.find_operators( Milestone, :instance_methods => true )
79
+
80
+ DataShift::MethodDictionary.build_method_details( Milestone )
81
+
82
+ method_detail = DataShift::MethodDictionary.find_method_detail( Milestone, :title )
83
+
84
+ method_detail.should_not be_nil
85
+
86
+ x, attributes = @populator.prepare_data(method_detail, value)
87
+
88
+ x.should == value
89
+ attributes.should be_a Hash
90
+ attributes.should be_empty
91
+
92
+ end
93
+
94
+ end
data/spec/thor_spec.rb CHANGED
@@ -32,7 +32,7 @@ describe 'Thor high level command line tasks' do
32
32
 
33
33
  it "should list available datashift thor tasks" do
34
34
  x = capture(:stdout){ Thor::Runner.start(["list"]) }
35
- x.should =~ /.+datashift.+\n---------\n/
35
+ x.should start_with("datashift\n--------")
36
36
  x.should =~ / csv -i/
37
37
  x.should =~ / excel -i/
38
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datashift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-06 00:00:00.000000000 Z
12
+ date: 2014-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spreadsheet
@@ -64,79 +64,80 @@ files:
64
64
  - tasks/db_tasks.rake
65
65
  - tasks/file_tasks.rake
66
66
  - tasks/word_to_seedfu.rake
67
- - lib/exporters/csv_exporter.rb
68
- - lib/exporters/exporter_base.rb
69
- - lib/exporters/excel_exporter.rb
70
- - lib/datashift/logging.rb
71
- - lib/datashift/model_mapper.rb
72
- - lib/datashift/exceptions.rb
73
- - lib/datashift/column_packer.rb
74
- - lib/datashift/method_details_manager.rb
75
- - lib/datashift/method_dictionary.rb
76
- - lib/datashift/method_mapper.rb
77
- - lib/datashift/file_definitions.rb
78
- - lib/datashift/delimiters.rb
79
- - lib/datashift/populator.rb
80
- - lib/datashift/method_detail.rb
81
- - lib/datashift/mapping_file_definitions.rb
82
- - lib/datashift/querying.rb
83
- - lib/guards.rb
67
+ - lib/applications/ruby_poi_translations.rb
68
+ - lib/applications/jexcel_file_extensions.rb
69
+ - lib/applications/spreadsheet_extensions.rb
84
70
  - lib/applications/excel.rb
85
71
  - lib/applications/apache_poi_extensions.rb
86
- - lib/applications/jexcel_file.rb
87
- - lib/applications/ruby_poi_translations.rb
72
+ - lib/applications/excel_base.rb
88
73
  - lib/applications/jruby/old_pre_proxy_jexcel_file.rb
89
74
  - lib/applications/jruby/word.rb
90
- - lib/applications/jexcel_file_extensions.rb
91
- - lib/applications/excel_base.rb
92
- - lib/applications/spreadsheet_extensions.rb
75
+ - lib/applications/jexcel_file.rb
76
+ - lib/java/poi-3.7/NOTICE
77
+ - lib/java/poi-3.7/poi-examples-3.7-20101029.jar
78
+ - lib/java/poi-3.7/RELEASE_NOTES.txt
79
+ - lib/java/poi-3.7/ooxml-lib/geronimo-stax-api_1.0_spec-1.0.jar
80
+ - lib/java/poi-3.7/ooxml-lib/xmlbeans-2.3.0.jar
81
+ - lib/java/poi-3.7/ooxml-lib/dom4j-1.6.1.jar
82
+ - lib/java/poi-3.7/LICENSE
83
+ - lib/java/poi-3.7/lib/junit-3.8.1.jar
84
+ - lib/java/poi-3.7/lib/commons-logging-1.1.jar
85
+ - lib/java/poi-3.7/lib/log4j-1.2.13.jar
86
+ - lib/java/poi-3.7/poi-scratchpad-3.7-20101029.jar
87
+ - lib/java/poi-3.7/poi-3.7-20101029.jar
88
+ - lib/java/poi-3.7/poi-ooxml-schemas-3.7-20101029.jar
89
+ - lib/java/poi-3.7/poi-ooxml-3.7-20101029.jar
90
+ - lib/loaders/csv_loader.rb
91
+ - lib/loaders/excel_loader.rb
93
92
  - lib/loaders/reporter.rb
94
93
  - lib/loaders/loader_base.rb
95
94
  - lib/loaders/paperclip/datashift_paperclip.rb
96
95
  - lib/loaders/paperclip/attachment_loader.rb
97
96
  - lib/loaders/paperclip/image_loading.rb
98
- - lib/loaders/csv_loader.rb
99
- - lib/loaders/excel_loader.rb
97
+ - lib/exporters/exporter_base.rb
98
+ - lib/exporters/excel_exporter.rb
99
+ - lib/exporters/csv_exporter.rb
100
+ - lib/datashift/populator.rb
101
+ - lib/datashift/querying.rb
102
+ - lib/datashift/method_detail.rb
103
+ - lib/datashift/column_packer.rb
104
+ - lib/datashift/method_details_manager.rb
105
+ - lib/datashift/model_mapper.rb
106
+ - lib/datashift/guards.rb
107
+ - lib/datashift/method_mapper.rb
108
+ - lib/datashift/mapping_file_definitions.rb
109
+ - lib/datashift/logging.rb
110
+ - lib/datashift/exceptions.rb
111
+ - lib/datashift/method_dictionary.rb
112
+ - lib/datashift/file_definitions.rb
113
+ - lib/datashift/delimiters.rb
100
114
  - lib/datashift.rb
115
+ - lib/generators/generator_base.rb
116
+ - lib/generators/csv_generator.rb
117
+ - lib/generators/excel_generator.rb
101
118
  - lib/thor/export.thor
119
+ - lib/thor/paperclip.thor
102
120
  - lib/thor/tools.thor
103
- - lib/thor/generate.thor
104
121
  - lib/thor/import.thor
105
- - lib/thor/paperclip.thor
106
- - lib/generators/generator_base.rb
107
- - lib/generators/excel_generator.rb
108
- - lib/generators/csv_generator.rb
122
+ - lib/thor/generate.thor
109
123
  - lib/helpers/core_ext/to_b.rb
110
- - lib/java/poi-3.7/poi-examples-3.7-20101029.jar
111
- - lib/java/poi-3.7/ooxml-lib/geronimo-stax-api_1.0_spec-1.0.jar
112
- - lib/java/poi-3.7/ooxml-lib/xmlbeans-2.3.0.jar
113
- - lib/java/poi-3.7/ooxml-lib/dom4j-1.6.1.jar
114
- - lib/java/poi-3.7/RELEASE_NOTES.txt
115
- - lib/java/poi-3.7/poi-ooxml-schemas-3.7-20101029.jar
116
- - lib/java/poi-3.7/LICENSE
117
- - lib/java/poi-3.7/poi-scratchpad-3.7-20101029.jar
118
- - lib/java/poi-3.7/NOTICE
119
- - lib/java/poi-3.7/poi-ooxml-3.7-20101029.jar
120
- - lib/java/poi-3.7/lib/junit-3.8.1.jar
121
- - lib/java/poi-3.7/lib/commons-logging-1.1.jar
122
- - lib/java/poi-3.7/lib/log4j-1.2.13.jar
123
- - lib/java/poi-3.7/poi-3.7-20101029.jar
124
+ - spec/csv_exporter_spec.rb
125
+ - spec/excel_generator_spec.rb
126
+ - spec/spec_helper.rb
124
127
  - spec/Gemfile
125
- - spec/method_mapper_spec.rb
126
128
  - spec/thor_spec.rb
129
+ - spec/datashift_spec.rb
130
+ - spec/populator_spec.rb
131
+ - spec/excel_loader_spec.rb
132
+ - spec/method_dictionary_spec.rb
133
+ - spec/excel_exporter_spec.rb
134
+ - spec/Gemfile.lock
127
135
  - spec/file_definitions.rb
136
+ - spec/loader_base_spec.rb
137
+ - spec/csv_loader_spec.rb
128
138
  - spec/paperclip_loader_spec.rb
129
- - spec/excel_generator_spec.rb
139
+ - spec/method_mapper_spec.rb
130
140
  - spec/excel_spec.rb
131
- - spec/Gemfile.lock
132
- - spec/excel_exporter_spec.rb
133
- - spec/csv_loader_spec.rb
134
- - spec/method_dictionary_spec.rb
135
- - spec/csv_exporter_spec.rb
136
- - spec/datashift_spec.rb
137
- - spec/excel_loader_spec.rb
138
- - spec/loader_spec.rb
139
- - spec/spec_helper.rb
140
141
  homepage: http://github.com/autotelik/datashift
141
142
  licenses:
142
143
  - MIT
@@ -158,24 +159,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
159
  version: '0'
159
160
  requirements: []
160
161
  rubyforge_project:
161
- rubygems_version: 1.8.24
162
+ rubygems_version: 1.8.25
162
163
  signing_key:
163
164
  specification_version: 3
164
165
  summary: Shift data betwen Excel/CSV and any Ruby app
165
166
  test_files:
167
+ - spec/csv_exporter_spec.rb
168
+ - spec/excel_generator_spec.rb
169
+ - spec/spec_helper.rb
166
170
  - spec/Gemfile
167
- - spec/method_mapper_spec.rb
168
171
  - spec/thor_spec.rb
172
+ - spec/datashift_spec.rb
173
+ - spec/populator_spec.rb
174
+ - spec/excel_loader_spec.rb
175
+ - spec/method_dictionary_spec.rb
176
+ - spec/excel_exporter_spec.rb
177
+ - spec/Gemfile.lock
169
178
  - spec/file_definitions.rb
179
+ - spec/loader_base_spec.rb
180
+ - spec/csv_loader_spec.rb
170
181
  - spec/paperclip_loader_spec.rb
171
- - spec/excel_generator_spec.rb
182
+ - spec/method_mapper_spec.rb
172
183
  - spec/excel_spec.rb
173
- - spec/Gemfile.lock
174
- - spec/excel_exporter_spec.rb
175
- - spec/csv_loader_spec.rb
176
- - spec/method_dictionary_spec.rb
177
- - spec/csv_exporter_spec.rb
178
- - spec/datashift_spec.rb
179
- - spec/excel_loader_spec.rb
180
- - spec/loader_spec.rb
181
- - spec/spec_helper.rb