datashift 0.9.0 → 0.10.0
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/README.markdown +63 -64
- data/Rakefile +4 -7
- data/VERSION +1 -1
- data/datashift.gemspec +92 -62
- data/lib/applications/apache_poi_extensions.rb +62 -0
- data/lib/applications/excel.rb +78 -0
- data/lib/applications/excel_base.rb +65 -0
- data/lib/applications/jexcel_file.rb +222 -0
- data/lib/applications/jexcel_file_extensions.rb +244 -0
- data/lib/applications/jruby/{jexcel_file.rb → old_pre_proxy_jexcel_file.rb} +0 -0
- data/lib/applications/ruby_poi_translations.rb +64 -0
- data/lib/applications/spreadsheet_extensions.rb +31 -0
- data/lib/datashift/method_details_manager.rb +4 -0
- data/lib/exporters/csv_exporter.rb +3 -1
- data/lib/exporters/excel_exporter.rb +59 -74
- data/lib/generators/excel_generator.rb +70 -74
- data/lib/guards.rb +57 -0
- data/lib/loaders/excel_loader.rb +105 -105
- data/lib/loaders/loader_base.rb +43 -21
- data/lib/loaders/paperclip/attachment_loader.rb +104 -0
- data/lib/loaders/paperclip/datashift_paperclip.rb +78 -0
- data/lib/loaders/paperclip/{image_loader.rb → image_loading.rb} +2 -18
- data/lib/thor/{generate_excel.thor → generate.thor} +48 -0
- data/lib/thor/paperclip.thor +85 -0
- data/lib/thor/tools.thor +23 -2
- data/spec/Gemfile +1 -7
- data/spec/csv_exporter_spec.rb +4 -4
- data/spec/csv_loader_spec.rb +1 -1
- data/spec/excel_exporter_spec.rb +43 -45
- data/spec/excel_generator_spec.rb +132 -60
- data/spec/excel_loader_spec.rb +134 -140
- data/spec/excel_spec.rb +179 -0
- data/spec/fixtures/ProjectsMultiCategoriesHeaderLookup.xls +0 -0
- data/spec/fixtures/config/database.yml +2 -2
- data/spec/fixtures/db/datashift_test_models_db.sqlite +0 -0
- data/spec/{db → fixtures/db}/migrate/20110803201325_create_test_bed.rb +0 -0
- data/spec/fixtures/load_datashift.thor +3 -0
- data/spec/fixtures/models/category.rb +7 -0
- data/spec/fixtures/models/empty.rb +2 -0
- data/spec/fixtures/models/loader_release.rb +10 -0
- data/spec/fixtures/models/long_and_complex_table_linked_to_version.rb +6 -0
- data/spec/fixtures/models/milestone.rb +8 -0
- data/spec/fixtures/models/owner.rb +5 -0
- data/spec/fixtures/models/project.rb +26 -0
- data/spec/fixtures/models/test_model_defs.rb +67 -0
- data/spec/fixtures/models/version.rb +7 -0
- data/spec/loader_spec.rb +4 -3
- data/spec/method_dictionary_spec.rb +7 -6
- data/spec/method_mapper_spec.rb +3 -2
- data/spec/rails_sandbox/.gitignore +15 -0
- data/spec/rails_sandbox/Gemfile +40 -0
- data/spec/rails_sandbox/README.rdoc +261 -0
- data/spec/rails_sandbox/Rakefile +7 -0
- data/spec/rails_sandbox/app/assets/images/rails.png +0 -0
- data/spec/rails_sandbox/app/assets/javascripts/application.js +15 -0
- data/spec/rails_sandbox/app/assets/stylesheets/application.css +13 -0
- data/spec/rails_sandbox/app/controllers/application_controller.rb +3 -0
- data/spec/rails_sandbox/app/helpers/application_helper.rb +2 -0
- data/spec/rails_sandbox/app/mailers/.gitkeep +0 -0
- data/spec/rails_sandbox/app/models/.gitkeep +0 -0
- data/spec/rails_sandbox/app/models/category.rb +7 -0
- data/spec/rails_sandbox/app/models/empty.rb +2 -0
- data/spec/rails_sandbox/app/models/loader_release.rb +10 -0
- data/spec/rails_sandbox/app/models/long_and_complex_table_linked_to_version.rb +6 -0
- data/spec/rails_sandbox/app/models/milestone.rb +8 -0
- data/spec/rails_sandbox/app/models/owner.rb +5 -0
- data/spec/rails_sandbox/app/models/project.rb +26 -0
- data/spec/rails_sandbox/app/models/test_model_defs.rb +67 -0
- data/spec/rails_sandbox/app/models/version.rb +7 -0
- data/spec/rails_sandbox/app/views/layouts/application.html.erb +14 -0
- data/spec/rails_sandbox/config.ru +4 -0
- data/spec/rails_sandbox/config/application.rb +62 -0
- data/spec/rails_sandbox/config/boot.rb +6 -0
- data/spec/rails_sandbox/config/database.yml +20 -0
- data/spec/rails_sandbox/config/environment.rb +5 -0
- data/spec/rails_sandbox/config/environments/development.rb +37 -0
- data/spec/rails_sandbox/config/environments/production.rb +67 -0
- data/spec/rails_sandbox/config/environments/test.rb +37 -0
- data/spec/rails_sandbox/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_sandbox/config/initializers/inflections.rb +15 -0
- data/spec/rails_sandbox/config/initializers/mime_types.rb +5 -0
- data/spec/rails_sandbox/config/initializers/secret_token.rb +7 -0
- data/spec/rails_sandbox/config/initializers/session_store.rb +8 -0
- data/spec/rails_sandbox/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_sandbox/config/locales/en.yml +5 -0
- data/spec/rails_sandbox/config/routes.rb +58 -0
- data/spec/rails_sandbox/db/migrate/20110803201325_create_test_bed.rb +96 -0
- data/spec/rails_sandbox/db/schema.rb +81 -0
- data/spec/rails_sandbox/db/seeds.rb +7 -0
- data/spec/rails_sandbox/lib/assets/.gitkeep +0 -0
- data/spec/rails_sandbox/lib/tasks/.gitkeep +0 -0
- data/spec/rails_sandbox/log/.gitkeep +0 -0
- data/spec/rails_sandbox/public/404.html +26 -0
- data/spec/rails_sandbox/public/422.html +26 -0
- data/spec/rails_sandbox/public/500.html +25 -0
- data/spec/rails_sandbox/public/favicon.ico +0 -0
- data/spec/rails_sandbox/public/index.html +241 -0
- data/spec/rails_sandbox/public/robots.txt +5 -0
- data/spec/rails_sandbox/script/rails +6 -0
- data/spec/rails_sandbox/test/fixtures/.gitkeep +0 -0
- data/spec/rails_sandbox/test/functional/.gitkeep +0 -0
- data/spec/rails_sandbox/test/integration/.gitkeep +0 -0
- data/spec/rails_sandbox/test/performance/browsing_test.rb +12 -0
- data/spec/rails_sandbox/test/test_helper.rb +13 -0
- data/spec/rails_sandbox/test/unit/.gitkeep +0 -0
- data/spec/rails_sandbox/vendor/assets/javascripts/.gitkeep +0 -0
- data/spec/rails_sandbox/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/rails_sandbox/vendor/plugins/.gitkeep +0 -0
- data/spec/spec_helper.rb +144 -121
- data/spec/thor_spec.rb +34 -14
- metadata +207 -194
- data/lib/helpers/spree_helper.rb +0 -213
- data/lib/loaders/spreadsheet_loader.rb +0 -144
- data/lib/loaders/spree/image_loader.rb +0 -90
- data/lib/loaders/spree/product_loader.rb +0 -354
- data/lib/thor/spree/bootstrap_cleanup.thor +0 -61
- data/lib/thor/spree/products_images.thor +0 -252
- data/lib/thor/spree/reports.thor +0 -56
- data/public/spree/products/large/DEMO_001_ror_bag.jpeg +0 -0
- data/public/spree/products/large/DEMO_002_Powerstation.jpg +0 -0
- data/public/spree/products/large/DEMO_003_ror_mug.jpeg +0 -0
- data/public/spree/products/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/public/spree/products/mini/DEMO_002_Powerstation.jpg +0 -0
- data/public/spree/products/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/public/spree/products/original/DEMO_001_ror_bag.jpeg +0 -0
- data/public/spree/products/original/DEMO_002_Powerstation.jpg +0 -0
- data/public/spree/products/original/DEMO_003_ror_mug.jpeg +0 -0
- data/public/spree/products/product/DEMO_001_ror_bag.jpeg +0 -0
- data/public/spree/products/product/DEMO_002_Powerstation.jpg +0 -0
- data/public/spree/products/product/DEMO_003_ror_mug.jpeg +0 -0
- data/public/spree/products/small/DEMO_001_ror_bag.jpeg +0 -0
- data/public/spree/products/small/DEMO_002_Powerstation.jpg +0 -0
- data/public/spree/products/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/fixtures/datashift_Spree_db.sqlite +0 -0
- data/spec/fixtures/datashift_test_models_db.sqlite +0 -0
- data/spec/fixtures/negative/SpreeProdMiss1Mandatory.csv +0 -4
- data/spec/fixtures/negative/SpreeProdMiss1Mandatory.xls +0 -0
- data/spec/fixtures/negative/SpreeProdMissManyMandatory.csv +0 -4
- data/spec/fixtures/negative/SpreeProdMissManyMandatory.xls +0 -0
- data/spec/fixtures/spree/SpreeImages.xls +0 -0
- data/spec/fixtures/spree/SpreeMultiVariant.csv +0 -4
- data/spec/fixtures/spree/SpreeProducts.csv +0 -4
- data/spec/fixtures/spree/SpreeProducts.xls +0 -0
- data/spec/fixtures/spree/SpreeProductsDefaults.yml +0 -15
- data/spec/fixtures/spree/SpreeProductsMandatoryOnly.xls +0 -0
- data/spec/fixtures/spree/SpreeProductsMultiColumn.csv +0 -4
- data/spec/fixtures/spree/SpreeProductsMultiColumn.xls +0 -0
- data/spec/fixtures/spree/SpreeProductsSimple.csv +0 -4
- data/spec/fixtures/spree/SpreeProductsSimple.xls +0 -0
- data/spec/fixtures/spree/SpreeProductsWithImages.csv +0 -4
- data/spec/fixtures/spree/SpreeProductsWithImages.xls +0 -0
- data/spec/fixtures/spree/SpreeZoneExample.csv +0 -5
- data/spec/fixtures/spree/SpreeZoneExample.xls +0 -0
- data/spec/spree_exporter_spec.rb +0 -72
- data/spec/spree_generator_spec.rb +0 -96
- data/spec/spree_images_loader_spec.rb +0 -107
- data/spec/spree_loader_spec.rb +0 -375
- data/spec/spree_method_mapping_spec.rb +0 -226
- data/spec/spree_variants_loader_spec.rb +0 -189
- data/tasks/export/excel_generator.rake +0 -102
- data/tasks/import/excel.rake +0 -75
- data/test/helper.rb +0 -18
- data/test/test_interact.rb +0 -7
data/spec/excel_spec.rb
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# To change this template, choose Tools | Templates
|
|
2
|
+
# and open the template in the editor.
|
|
3
|
+
|
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
5
|
+
|
|
6
|
+
require 'excel'
|
|
7
|
+
|
|
8
|
+
describe 'Excel Proxy' do
|
|
9
|
+
|
|
10
|
+
before(:each) do
|
|
11
|
+
@excel = Excel.new
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it "can open an existing spreadsheet" do
|
|
15
|
+
|
|
16
|
+
sheet = @excel.open( ifixture_file('ProjectsSingleCategories.xls') )
|
|
17
|
+
|
|
18
|
+
sheet.should_not be_nil
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "can create new un-named worksheet" do
|
|
22
|
+
sheet1 = @excel.create_worksheet
|
|
23
|
+
|
|
24
|
+
sheet1.name.should == "Worksheet1"
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "can create multiple un-named worksheets" do
|
|
28
|
+
sheet1 = @excel.create_worksheet
|
|
29
|
+
sheet2 = @excel.create_worksheet
|
|
30
|
+
sheet1.name.should == "Worksheet1"
|
|
31
|
+
sheet2.name.should == "Worksheet2"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "can create new named worksheet" do
|
|
35
|
+
|
|
36
|
+
sheet = @excel.create_worksheet( :name => "daft punk")
|
|
37
|
+
sheet.name.should == "daft punk"
|
|
38
|
+
|
|
39
|
+
sheet2 = @excel.create_worksheet( :name => "underworld")
|
|
40
|
+
sheet2.name.should == "underworld"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "ensures name of worksheet sanitized" do
|
|
44
|
+
sheet = @excel.create_worksheet( :name => "daft: ?punk")
|
|
45
|
+
sheet.name.should == "daft punk"
|
|
46
|
+
|
|
47
|
+
sheet = @excel.create_worksheet( :name => "under[]world")
|
|
48
|
+
sheet.name.should == "underworld"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "can create multiple named worksheets" do
|
|
52
|
+
|
|
53
|
+
@excel.create_worksheet( :name => "underworld")
|
|
54
|
+
@excel.create_worksheet( :name => "jeff mills")
|
|
55
|
+
@excel.create_worksheet( :name => "autechre")
|
|
56
|
+
@excel.create_worksheet( :name => "swarms")
|
|
57
|
+
|
|
58
|
+
@excel.worksheets.should have_exactly(4).items
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "can access a worksheet by index" do
|
|
62
|
+
|
|
63
|
+
@excel.create_worksheet( :name => "underworld")
|
|
64
|
+
@excel.create_worksheet( :name => "jeff mills")
|
|
65
|
+
@excel.create_worksheet( :name => "autechre")
|
|
66
|
+
|
|
67
|
+
@excel.worksheets[0].name.should == "underworld"
|
|
68
|
+
@excel.worksheets[2].name.should == "autechre"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
it "can access a worksheet by ID" do
|
|
73
|
+
|
|
74
|
+
@excel.create_worksheet( :name => "daft punk")
|
|
75
|
+
@excel.create_worksheet( :name => "underworld")
|
|
76
|
+
|
|
77
|
+
@excel.worksheet(0).name.should == "daft punk"
|
|
78
|
+
|
|
79
|
+
@excel.worksheet(1).name.should == "underworld"
|
|
80
|
+
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it "can add data to a specific row and column" do
|
|
84
|
+
|
|
85
|
+
@excel.create_worksheet( :name => "underworld")
|
|
86
|
+
|
|
87
|
+
@excel[0, 1] = "born slippy"
|
|
88
|
+
@excel[0, 1].should == "born slippy"
|
|
89
|
+
|
|
90
|
+
@excel[1, 23] = 23.0
|
|
91
|
+
@excel[1, 23].should == 23.0
|
|
92
|
+
|
|
93
|
+
@excel[0, 5] = true
|
|
94
|
+
@excel[0, 5].should == true
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it "can ask a row what index it is" do
|
|
98
|
+
|
|
99
|
+
@excel.create_worksheet( :name => "underworld")
|
|
100
|
+
|
|
101
|
+
@excel[3, 0] = "do i know who i am?"
|
|
102
|
+
@excel[28, 0] = "who am i?"
|
|
103
|
+
|
|
104
|
+
r1 = @excel.row(3)
|
|
105
|
+
r1[0].should == "do i know who i am?"
|
|
106
|
+
r1.idx.should == 3 # idx (0-based)
|
|
107
|
+
|
|
108
|
+
r2 = @excel.row(28)
|
|
109
|
+
r2[0].should == "who am i?"
|
|
110
|
+
r2.idx.should == 28 # idx (0-based)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it "can iterate over the rows in a worksheet" do
|
|
114
|
+
|
|
115
|
+
sheet = @excel.create_worksheet
|
|
116
|
+
|
|
117
|
+
@excel[0, 1] = 12.30
|
|
118
|
+
@excel[1, 1] = 25.30
|
|
119
|
+
@excel[3, 1] = 4
|
|
120
|
+
|
|
121
|
+
sheet.each do |row|
|
|
122
|
+
row[0] = "A#{row.idx}"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
@excel[0, 0].should == "A0"
|
|
126
|
+
@excel[1, 0].should == "A1"
|
|
127
|
+
|
|
128
|
+
# pending for JRuby ... spreadsheet iterates from 0 to max row, probably
|
|
129
|
+
# dynamically creating rows that have never been referenced ..
|
|
130
|
+
@excel[2, 0].should == "A2" unless DataShift::Guards.jruby?
|
|
131
|
+
|
|
132
|
+
@excel[3, 0].should == "A3"
|
|
133
|
+
|
|
134
|
+
@excel[0, 1].should == 12.30
|
|
135
|
+
@excel[1, 1].should == 25.30
|
|
136
|
+
@excel[2, 1].should satisfy {|x| x == "" || x == nil }
|
|
137
|
+
@excel[3, 1].should == 4
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
it "can iterate over the cells in a row"do
|
|
142
|
+
|
|
143
|
+
sheet = @excel.create_worksheet
|
|
144
|
+
|
|
145
|
+
values = [ 'hello world', 12.30, "", 4 ]
|
|
146
|
+
|
|
147
|
+
values.each_with_index do |v, i|
|
|
148
|
+
@excel[0, i] = v
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
row = @excel.row(0)
|
|
152
|
+
|
|
153
|
+
row.each { |col| col.should == values.shift }
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
it "can support bools" do
|
|
158
|
+
pending("reading back value sometimes returns "" when cell was set to false")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it "can write an Excel file" do
|
|
162
|
+
@excel = Excel.new
|
|
163
|
+
|
|
164
|
+
sheet1 = @excel.create_worksheet
|
|
165
|
+
|
|
166
|
+
@excel.create_worksheet( :name => "underworld")
|
|
167
|
+
|
|
168
|
+
@excel[0, 1] = "born slippy"
|
|
169
|
+
@excel[0, 1].should == "born slippy"
|
|
170
|
+
|
|
171
|
+
expected = result_file('it_can_save_an_excel_file.xls')
|
|
172
|
+
|
|
173
|
+
@excel.write( expected )
|
|
174
|
+
|
|
175
|
+
File.exists?(expected).should be_true
|
|
176
|
+
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
Binary file
|
|
@@ -17,12 +17,12 @@ test_memory:
|
|
|
17
17
|
|
|
18
18
|
test_file:
|
|
19
19
|
adapter: <%= adapter %>
|
|
20
|
-
database: <%= File.join(
|
|
20
|
+
database: <%= File.join(fixtures_path(), 'db', 'datashift_test_models_db.sqlite') %>
|
|
21
21
|
encoding: utf8
|
|
22
22
|
host: localhost
|
|
23
23
|
|
|
24
24
|
test_spree_standalone:
|
|
25
25
|
adapter: <%= adapter %>
|
|
26
|
-
database: <%= File.join(
|
|
26
|
+
database: <%= File.join(fixtures_path(), 'db', 'datashift_Spree_db.sqlite') %>
|
|
27
27
|
encoding: utf8
|
|
28
28
|
host: localhost
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# A set of models and associations we can use in our specs to test
|
|
2
|
+
# basic database columns and also relationships
|
|
3
|
+
|
|
4
|
+
# See Companion migration spec/db/migrate
|
|
5
|
+
|
|
6
|
+
class Project < ActiveRecord::Base
|
|
7
|
+
|
|
8
|
+
has_one :owner
|
|
9
|
+
|
|
10
|
+
has_many :milestones
|
|
11
|
+
|
|
12
|
+
has_many :loader_releases
|
|
13
|
+
has_many :versions, :through => :loader_releases
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
#has_many :release_versions, :through => :loader_releases, :source => :versions
|
|
17
|
+
|
|
18
|
+
has_and_belongs_to_many :categories
|
|
19
|
+
|
|
20
|
+
attr_accessible :value_as_string, :value_as_boolean, :value_as_double
|
|
21
|
+
|
|
22
|
+
def multiply
|
|
23
|
+
10 * value_as_double
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# A set of models and associations we can use in our specs to test
|
|
2
|
+
# basic database columns and also relationships
|
|
3
|
+
|
|
4
|
+
# See Companion migration spec/db/migrate
|
|
5
|
+
|
|
6
|
+
class Project < ActiveRecord::Base
|
|
7
|
+
|
|
8
|
+
has_one :owner
|
|
9
|
+
|
|
10
|
+
has_many :milestones
|
|
11
|
+
|
|
12
|
+
has_many :loader_releases
|
|
13
|
+
has_many :versions, :through => :loader_releases
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
#has_many :release_versions, :through => :loader_releases, :source => :versions
|
|
17
|
+
|
|
18
|
+
has_and_belongs_to_many :categories
|
|
19
|
+
|
|
20
|
+
attr_accessible :value_as_string, :value_as_boolean, :value_as_double
|
|
21
|
+
|
|
22
|
+
def multiply
|
|
23
|
+
10 * value_as_double
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class Owner < ActiveRecord::Base
|
|
29
|
+
belongs_to :project
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
class Milestone < ActiveRecord::Base
|
|
33
|
+
belongs_to :project
|
|
34
|
+
#validate the name, cost
|
|
35
|
+
|
|
36
|
+
delegate :title, :title=, :to => :project
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# had_and_belongs to join table
|
|
40
|
+
class Category < ActiveRecord::Base
|
|
41
|
+
has_and_belongs_to_many :projects
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class Version < ActiveRecord::Base
|
|
46
|
+
has_many :releases
|
|
47
|
+
|
|
48
|
+
has_one :long_and_complex_table_linked_to_version
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Join Table with additional columns
|
|
52
|
+
class LoaderRelease < ActiveRecord::Base
|
|
53
|
+
|
|
54
|
+
belongs_to :project
|
|
55
|
+
belongs_to :version
|
|
56
|
+
|
|
57
|
+
#validate the name
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
class Empty < ActiveRecord::Base
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Join Table with additional columns
|
|
64
|
+
class LongAndComplexTableLinkedToVersion < ActiveRecord::Base
|
|
65
|
+
|
|
66
|
+
belongs_to :version
|
|
67
|
+
end
|
data/spec/loader_spec.rb
CHANGED
|
@@ -12,10 +12,11 @@ require 'erb'
|
|
|
12
12
|
describe 'Basic Loader' do
|
|
13
13
|
|
|
14
14
|
before(:all) do
|
|
15
|
-
db_connect( 'test_file' ) # , test_memory, test_mysql
|
|
16
15
|
|
|
17
|
-
# load our test model definitions - Project etc
|
|
18
|
-
require
|
|
16
|
+
# load our test model definitions - Project etc
|
|
17
|
+
require ifixture_file('test_model_defs')
|
|
18
|
+
|
|
19
|
+
db_connect( 'test_file' ) # , test_memory, test_mysql
|
|
19
20
|
|
|
20
21
|
migrate_up
|
|
21
22
|
@klazz = Project
|
|
@@ -12,10 +12,11 @@ require File.dirname(__FILE__) + '/spec_helper'
|
|
|
12
12
|
describe 'Method Mapping' do
|
|
13
13
|
|
|
14
14
|
before(:all) do
|
|
15
|
-
db_connect( 'test_file' ) # , test_memory, test_mysql
|
|
16
15
|
|
|
17
|
-
# load our test model definitions - Project etc
|
|
16
|
+
# load our test model definitions - Project etc
|
|
18
17
|
require ifixture_file('test_model_defs')
|
|
18
|
+
|
|
19
|
+
db_connect( 'test_file' ) # , test_memory, test_mysql
|
|
19
20
|
|
|
20
21
|
migrate_up
|
|
21
22
|
end
|
|
@@ -170,7 +171,7 @@ describe 'Method Mapping' do
|
|
|
170
171
|
end
|
|
171
172
|
end
|
|
172
173
|
|
|
173
|
-
|
|
174
|
+
it "should populate required Class for has_one operator method details" do
|
|
174
175
|
|
|
175
176
|
MethodDictionary.find_operators( Version )
|
|
176
177
|
MethodDictionary.build_method_details( Version )
|
|
@@ -223,14 +224,14 @@ describe 'Method Mapping' do
|
|
|
223
224
|
|
|
224
225
|
|
|
225
226
|
it "should find a set of methods based on a list of column names" do
|
|
226
|
-
|
|
227
|
+
pending("key API - map column headers to set of methods")
|
|
227
228
|
end
|
|
228
229
|
|
|
229
|
-
it "should not by default map setter methods"
|
|
230
|
+
it "should not by default map setter methods" do
|
|
230
231
|
MethodDictionary.assignments[Milestone].should_not include('title')
|
|
231
232
|
end
|
|
232
233
|
|
|
233
|
-
it "should support reload and inclusion of setter methods"
|
|
234
|
+
it "should support reload and inclusion of setter methods" do
|
|
234
235
|
|
|
235
236
|
MethodDictionary.assignments[Milestone].should_not include('title')
|
|
236
237
|
|
data/spec/method_mapper_spec.rb
CHANGED
|
@@ -12,10 +12,11 @@ require File.dirname(__FILE__) + '/spec_helper'
|
|
|
12
12
|
describe 'Method Mapping' do
|
|
13
13
|
|
|
14
14
|
before(:all) do
|
|
15
|
-
db_connect( 'test_file' ) # , test_memory, test_mysql
|
|
16
15
|
|
|
17
|
-
# load our test model definitions - Project etc
|
|
16
|
+
# load our test model definitions - Project etc
|
|
18
17
|
require ifixture_file('test_model_defs')
|
|
18
|
+
|
|
19
|
+
db_connect( 'test_file' ) # , test_memory, test_mysql
|
|
19
20
|
|
|
20
21
|
migrate_up
|
|
21
22
|
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
2
|
+
#
|
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
|
6
|
+
|
|
7
|
+
# Ignore bundler config
|
|
8
|
+
/.bundle
|
|
9
|
+
|
|
10
|
+
# Ignore the default SQLite database.
|
|
11
|
+
/db/*.sqlite3
|
|
12
|
+
|
|
13
|
+
# Ignore all logfiles and tempfiles.
|
|
14
|
+
/log/*.log
|
|
15
|
+
/tmp
|