spreadsheet_architect 2.1.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +17 -2
- data/README.md +149 -129
- data/lib/spreadsheet_architect/class_methods/csv.rb +2 -2
- data/lib/spreadsheet_architect/class_methods/ods.rb +2 -2
- data/lib/spreadsheet_architect/class_methods/xlsx.rb +26 -30
- data/lib/spreadsheet_architect/exceptions.rb +32 -30
- data/lib/spreadsheet_architect/utils/xlsx.rb +46 -25
- data/lib/spreadsheet_architect/utils.rb +116 -121
- data/lib/spreadsheet_architect/version.rb +1 -1
- data/lib/spreadsheet_architect.rb +5 -1
- data/test/dummy_app/app/models/active_model_object.rb +1 -0
- data/test/dummy_app/app/models/custom_post.rb +1 -0
- data/test/dummy_app/app/models/legacy_plain_ruby_object.rb +14 -0
- data/test/dummy_app/app/models/plain_ruby_object.rb +2 -9
- data/test/dummy_app/app/models/post.rb +3 -0
- data/test/dummy_app/config/routes.rb +4 -5
- data/test/dummy_app/db/test.sqlite3 +0 -0
- data/test/dummy_app/log/test.log +26911 -21739
- data/test/dummy_app/tmp/2.0.1/integration/alt_xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/integration/csv.csv +6 -0
- data/test/dummy_app/tmp/2.0.1/integration/ods.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/integration/xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/kitchen_sink.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/kitchen_sink.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/data.csv +3 -0
- data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/data.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/data.xlsx +0 -0
- data/test/dummy_app/tmp/{empty_sa.csv → 2.0.1/models/ActiveModelObject/empty.csv} +0 -0
- data/test/dummy_app/tmp/{ods/empty_model.ods → 2.0.1/models/ActiveModelObject/empty.ods} +0 -0
- data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/empty.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/instances.csv +6 -0
- data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/instances.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/ActiveModelObject/instances.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/CustomPost/data.csv +3 -0
- data/test/dummy_app/tmp/2.0.1/models/CustomPost/data.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/CustomPost/data.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/CustomPost/empty.csv +1 -0
- data/test/dummy_app/tmp/2.0.1/models/CustomPost/empty.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/CustomPost/empty.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/CustomPost/instances.csv +6 -0
- data/test/dummy_app/tmp/2.0.1/models/CustomPost/instances.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/CustomPost/instances.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/data.csv +3 -0
- data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/data.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/data.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/empty.csv +1 -0
- data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/empty.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/empty.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/instances.csv +6 -0
- data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/instances.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/LegacyPlainRubyObject/instances.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/data.csv +3 -0
- data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/data.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/data.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/empty.csv +0 -0
- data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/empty.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/empty.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/instances.csv +6 -0
- data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/instances.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/PlainRubyObject/instances.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/Post/data.csv +3 -0
- data/test/dummy_app/tmp/2.0.1/models/Post/data.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/Post/data.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/Post/empty.csv +0 -0
- data/test/dummy_app/tmp/2.0.1/models/Post/empty.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/Post/empty.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/data.csv +3 -0
- data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/data.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/data.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/empty.csv +0 -0
- data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/empty.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/models/SpreadsheetArchitect/empty.xlsx +0 -0
- data/test/dummy_app/tmp/2.0.1/multi_sheet.ods +0 -0
- data/test/dummy_app/tmp/2.0.1/multi_sheet.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/integration/alt_xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/integration/csv.csv +6 -0
- data/test/dummy_app/tmp/3.0.0.pre/integration/ods.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/integration/xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/kitchen_sink.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/kitchen_sink.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/data.csv +3 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/data.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/data.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/empty.csv +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/empty.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/empty.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/instances.csv +6 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/instances.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/ActiveModelObject/instances.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/data.csv +3 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/data.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/data.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/empty.csv +1 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/empty.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/empty.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/instances.csv +6 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/instances.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/CustomPost/instances.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/data.csv +3 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/data.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/data.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/empty.csv +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/empty.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/empty.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/instances.csv +6 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/instances.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/LegacyPlainRubyObject/instances.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/data.csv +3 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/data.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/data.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/empty.csv +1 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/empty.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/empty.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/instances.csv +6 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/instances.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/PlainRubyObject/instances.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/Post/data.csv +3 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/Post/data.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/Post/data.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/Post/empty.csv +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/Post/empty.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/Post/empty.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/data.csv +3 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/data.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/data.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/empty.csv +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/empty.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/models/SpreadsheetArchitect/empty.xlsx +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/multi_sheet.ods +0 -0
- data/test/dummy_app/tmp/3.0.0.pre/multi_sheet.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/integration/alt_xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/integration/csv.csv +6 -0
- data/test/dummy_app/tmp/axlsx-master/integration/ods.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/integration/xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/kitchen_sink.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/kitchen_sink.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/data.csv +3 -0
- data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/data.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/data.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/empty.csv +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/empty.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/empty.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/instances.csv +6 -0
- data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/instances.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/ActiveModelObject/instances.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/CustomPost/data.csv +3 -0
- data/test/dummy_app/tmp/axlsx-master/models/CustomPost/data.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/CustomPost/data.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/CustomPost/empty.csv +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/CustomPost/empty.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/CustomPost/empty.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/CustomPost/instances.csv +6 -0
- data/test/dummy_app/tmp/axlsx-master/models/CustomPost/instances.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/CustomPost/instances.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/data.csv +3 -0
- data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/data.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/data.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/empty.csv +1 -0
- data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/empty.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/empty.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/instances.csv +6 -0
- data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/instances.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/LegacyPlainRubyObject/instances.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/data.csv +3 -0
- data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/data.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/data.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/empty.csv +1 -0
- data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/empty.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/empty.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/instances.csv +6 -0
- data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/instances.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/PlainRubyObject/instances.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/Post/data.csv +3 -0
- data/test/dummy_app/tmp/axlsx-master/models/Post/data.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/Post/data.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/Post/empty.csv +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/Post/empty.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/Post/empty.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/data.csv +3 -0
- data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/data.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/data.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/empty.csv +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/empty.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/models/SpreadsheetArchitect/empty.xlsx +0 -0
- data/test/dummy_app/tmp/axlsx-master/multi_sheet.ods +0 -0
- data/test/dummy_app/tmp/axlsx-master/multi_sheet.xlsx +0 -0
- data/test/integration/application_test.rb +8 -11
- data/test/models/all_models_test.rb +107 -0
- data/test/test_helper.rb +13 -4
- data/test/unit/exceptions_test.rb +168 -0
- data/test/unit/formats_test.rb +15 -0
- data/test/unit/general_test.rb +15 -0
- data/test/unit/kitchen_sink_test.rb +87 -0
- data/test/unit/multi_sheet_test.rb +29 -0
- data/test/unit/utils_test.rb +179 -0
- data/test/unit/xlsx_utils_test.rb +143 -0
- metadata +409 -116
- data/lib/generators/spreadsheet_architect/add_project_defaults_generator.rb +0 -20
- data/test/dummy_app/app/models/bad_plain_ruby_object.rb +0 -3
- data/test/dummy_app/app/views/reports/sample.html.erb +0 -1
- data/test/dummy_app/log/development.log +0 -28
- data/test/dummy_app/tmp/active_model_object/csv.csv +0 -21
- data/test/dummy_app/tmp/active_model_object/ods.ods +0 -0
- data/test/dummy_app/tmp/active_model_object/xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/custom_posts/csv.csv +0 -6
- data/test/dummy_app/tmp/custom_posts/empty.xlsx +0 -0
- data/test/dummy_app/tmp/custom_posts/ods.ods +0 -0
- data/test/dummy_app/tmp/custom_posts/xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/empty_model.csv +0 -1
- data/test/dummy_app/tmp/empty_model.xlsx +0 -0
- data/test/dummy_app/tmp/empty_sa.xlsx +0 -0
- data/test/dummy_app/tmp/extreme.xlsx +0 -0
- data/test/dummy_app/tmp/integration_tests/alt_xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/integration_tests/csv.csv +0 -6
- data/test/dummy_app/tmp/integration_tests/ods.ods +0 -0
- data/test/dummy_app/tmp/integration_tests/xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/model.csv +0 -6
- data/test/dummy_app/tmp/model.xlsx +0 -0
- data/test/dummy_app/tmp/ods/empty_sa.ods +0 -0
- data/test/dummy_app/tmp/ods/model.ods +0 -0
- data/test/dummy_app/tmp/ods/model_options.ods +0 -0
- data/test/dummy_app/tmp/ods/sa.ods +0 -0
- data/test/dummy_app/tmp/options.csv +0 -6
- data/test/dummy_app/tmp/plain_ruby_object/csv.csv +0 -4
- data/test/dummy_app/tmp/plain_ruby_object/ods.ods +0 -0
- data/test/dummy_app/tmp/plain_ruby_object/xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/posts/csv.csv +0 -6
- data/test/dummy_app/tmp/posts/empty.xlsx +0 -0
- data/test/dummy_app/tmp/posts/ods.ods +0 -0
- data/test/dummy_app/tmp/posts/xlsx.xlsx +0 -0
- data/test/dummy_app/tmp/sa.csv +0 -4
- data/test/dummy_app/tmp/sa.xlsx +0 -0
- data/test/models/active_model_object_test.rb +0 -51
- data/test/models/bad_plain_ruby_object_test.rb +0 -28
- data/test/models/csv_test.rb +0 -59
- data/test/models/custom_post_test.rb +0 -51
- data/test/models/ods_test.rb +0 -65
- data/test/models/plain_ruby_object_test.rb +0 -51
- data/test/models/post_test.rb +0 -44
- data/test/models/spreadsheet_architect_utils_test.rb +0 -73
- data/test/models/xlsx_test.rb +0 -98
- data/test/spreadsheet_architect_test.rb +0 -11
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
module SpreadsheetArchitect
|
4
|
-
class AddDefaultOptionsGenerator < Rails::Generators::Base
|
5
|
-
|
6
|
-
def add_default_options
|
7
|
-
create_file "config/initializers/spreadsheet_architect.rb", <<eos
|
8
|
-
SpreadsheetArchitect.default_options = {
|
9
|
-
headers: true,
|
10
|
-
header_style: {background_color: "AAAAAA", color: "FFFFFF", align: :center, bold: false, font_name: 'Arial', font_size: 10, italic: false, underline: false},
|
11
|
-
row_style: {background_color: nil, color: "000000", align: :left, bold: false, font_name: 'Arial', font_size: 10, italic: false, underline: false},
|
12
|
-
column_styles: [],
|
13
|
-
range_styles: [],
|
14
|
-
borders: []
|
15
|
-
}
|
16
|
-
eos
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>Hello World!</h1>
|
@@ -1,28 +0,0 @@
|
|
1
|
-
[1m[35m (0.6ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
2
|
-
[1m[35m (4.4ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)[0m
|
3
|
-
[1m[35m (1.1ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
4
|
-
[1m[35m (0.6ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
5
|
-
Migrating to AddPosts (20170103234524)
|
6
|
-
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
7
|
-
[1m[35m (0.6ms)[0m [1m[35mCREATE TABLE "posts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "content" text, "age" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
8
|
-
[1m[36mActiveRecord::SchemaMigration Create (0.7ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20170103234524"]]
|
9
|
-
[1m[35m (0.9ms)[0m [1m[36mcommit transaction[0m
|
10
|
-
[1m[36mActiveRecord::InternalMetadata Load (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", "environment"], ["LIMIT", 1]]
|
11
|
-
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
12
|
-
[1m[36mActiveRecord::InternalMetadata Create (0.4ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?)[0m [["key", "environment"], ["value", "development"], ["created_at", "2018-06-20 05:00:54.439886"], ["updated_at", "2018-06-20 05:00:54.439886"]]
|
13
|
-
[1m[35m (0.8ms)[0m [1m[36mcommit transaction[0m
|
14
|
-
[1m[35m (0.3ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
15
|
-
[1m[35m (0.1ms)[0m [1m[34mSELECT sqlite_version(*)[0m
|
16
|
-
[1m[35m (2.0ms)[0m [1m[35mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)[0m
|
17
|
-
[1m[35m (1.0ms)[0m [1m[35mCREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
18
|
-
[1m[35m (0.2ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
19
|
-
Migrating to AddPosts (20170103234524)
|
20
|
-
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
21
|
-
[1m[35m (0.5ms)[0m [1m[35mCREATE TABLE "posts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "content" text, "age" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)[0m
|
22
|
-
[1m[36mActiveRecord::SchemaMigration Create (0.2ms)[0m [1m[32mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20170103234524"]]
|
23
|
-
[1m[35m (1.1ms)[0m [1m[36mcommit transaction[0m
|
24
|
-
[1m[36mActiveRecord::InternalMetadata Load (0.2ms)[0m [1m[34mSELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ?[0m [["key", "environment"], ["LIMIT", 1]]
|
25
|
-
[1m[35m (0.1ms)[0m [1m[36mbegin transaction[0m
|
26
|
-
[1m[36mActiveRecord::InternalMetadata Create (0.4ms)[0m [1m[32mINSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?)[0m [["key", "environment"], ["value", "development"], ["created_at", "2018-06-20 05:04:49.783707"], ["updated_at", "2018-06-20 05:04:49.783707"]]
|
27
|
-
[1m[35m (0.7ms)[0m [1m[36mcommit transaction[0m
|
28
|
-
[1m[35m (0.2ms)[0m [1m[34mSELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC[0m
|
@@ -1,21 +0,0 @@
|
|
1
|
-
Name,Content,Created At
|
2
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
3
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
4
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
5
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
6
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
7
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
8
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
9
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
10
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
11
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
12
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
13
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
14
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
15
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
16
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
17
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
18
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
19
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
20
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
21
|
-
asd,asd,2018-07-06 07:28:41 -0700
|
Binary file
|
Binary file
|
@@ -1,6 +0,0 @@
|
|
1
|
-
Name,The Content,Created At,Created At Date,asd
|
2
|
-
foo 0,bar 0,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
|
3
|
-
foo 1,bar 1,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
|
4
|
-
foo 2,bar 2,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
|
5
|
-
foo 3,bar 3,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
|
6
|
-
foo 4,bar 4,2018-06-20 15:46:34 UTC,2018-06-20,tadaaa
|
Binary file
|
Binary file
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
Name,Content,Age
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/dummy_app/tmp/sa.csv
DELETED
data/test/dummy_app/tmp/sa.xlsx
DELETED
Binary file
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class ActiveModelObjectTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@path = Rails.root.join('tmp/active_model_object')
|
7
|
-
FileUtils.mkdir_p(@path)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_csv
|
11
|
-
assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
|
12
|
-
ActiveModelObject.to_csv
|
13
|
-
end
|
14
|
-
|
15
|
-
instances = 20.times.map{|_| ActiveModelObject.new(name: :asd, content: :asd, created_at: Time.now)}
|
16
|
-
data = ActiveModelObject.to_csv(instances: instances)
|
17
|
-
|
18
|
-
File.open(File.join(@path, 'csv.csv'), 'w+b') do |f|
|
19
|
-
f.write data
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_ods
|
24
|
-
assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
|
25
|
-
ActiveModelObject.to_ods
|
26
|
-
end
|
27
|
-
|
28
|
-
instances = 20.times.map{|_| ActiveModelObject.new(name: :asd, content: :asd, created_at: Time.now)}
|
29
|
-
data = ActiveModelObject.to_ods(instances: instances)
|
30
|
-
|
31
|
-
File.open(File.join(@path, 'ods.ods'), 'w+b') do |f|
|
32
|
-
f.write data
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_xlsx
|
37
|
-
assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
|
38
|
-
ActiveModelObject.to_xlsx
|
39
|
-
end
|
40
|
-
|
41
|
-
instances = 20.times.map{|_| ActiveModelObject.new(name: :asd, content: :asd, created_at: Time.now)}
|
42
|
-
data = ActiveModelObject.to_xlsx(instances: instances)
|
43
|
-
|
44
|
-
File.open(File.join(@path, 'xlsx.xlsx'), 'w+b') do |f|
|
45
|
-
f.write data
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def teardown
|
50
|
-
end
|
51
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class BadPlainRubyObjectTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
end
|
7
|
-
|
8
|
-
def test_csv
|
9
|
-
assert_raise SpreadsheetArchitect::Exceptions::SpreadsheetColumnsNotDefinedError do
|
10
|
-
BadPlainRubyObject.to_csv(instances: [])
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_ods
|
15
|
-
assert_raise SpreadsheetArchitect::Exceptions::SpreadsheetColumnsNotDefinedError do
|
16
|
-
BadPlainRubyObject.to_ods(instances: [])
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_xlsx
|
21
|
-
assert_raise SpreadsheetArchitect::Exceptions::SpreadsheetColumnsNotDefinedError do
|
22
|
-
BadPlainRubyObject.to_xlsx(instances: [])
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def teardown
|
27
|
-
end
|
28
|
-
end
|
data/test/models/csv_test.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class CsvTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@headers = ['test1', 'test2','test3']
|
7
|
-
@data = [
|
8
|
-
['row1'],
|
9
|
-
['row2 c1', 'row2 c2'],
|
10
|
-
['the','data']
|
11
|
-
]
|
12
|
-
@options = {
|
13
|
-
headers: true,
|
14
|
-
header_style: {background_color: 'AAAAAA', color: 'FFFFFF', align: :center, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
|
15
|
-
row_style: {background_color: nil, color: '000000', align: :left, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
|
16
|
-
sheet_name: 'My Project Export',
|
17
|
-
column_styles: [],
|
18
|
-
range_styles: [],
|
19
|
-
merges: [],
|
20
|
-
borders: [],
|
21
|
-
column_types: []
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_empty_model
|
26
|
-
Post.delete_all
|
27
|
-
File.open(Rails.root.join('tmp/empty_model.csv'),'w+b') do |f|
|
28
|
-
f.write Post.to_csv
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_empty_sa
|
33
|
-
File.open(Rails.root.join('tmp/empty_sa.csv'),'w+b') do |f|
|
34
|
-
f.write SpreadsheetArchitect.to_csv(data: [])
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_sa
|
39
|
-
File.open(Rails.root.join('tmp/sa.csv'),'w+b') do |f|
|
40
|
-
f.write SpreadsheetArchitect.to_csv(headers: @headers, data: @data)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_model
|
45
|
-
File.open(Rails.root.join('tmp/model.csv'),'w+b') do |f|
|
46
|
-
f.write Post.to_csv
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_options
|
51
|
-
File.open(Rails.root.join('tmp/options.csv'),'w+b') do |f|
|
52
|
-
f.write Post.to_csv(@options)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def teardown
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class CustomPostTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@path = File.join(Rails.root, 'tmp/custom_posts')
|
7
|
-
FileUtils.mkdir_p(@path)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_csv
|
11
|
-
data = CustomPost.to_csv
|
12
|
-
|
13
|
-
File.open(File.join(@path, 'csv.csv'), 'w+b') do |f|
|
14
|
-
f.write data
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_ods
|
19
|
-
data = CustomPost.to_ods
|
20
|
-
|
21
|
-
File.open(File.join(@path, 'ods.ods'), 'w+b') do |f|
|
22
|
-
f.write data
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_xlsx
|
27
|
-
data = CustomPost.all.to_xlsx
|
28
|
-
|
29
|
-
File.open(File.join(@path, 'xlsx.xlsx'), 'w+b') do |f|
|
30
|
-
f.write data
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_empty
|
35
|
-
Post.destroy_all
|
36
|
-
|
37
|
-
File.open(File.join(@path, 'empty.xlsx'), 'w+b') do |f|
|
38
|
-
f.write Post.to_xlsx
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_constants_dont_change
|
43
|
-
x = CustomPost::SPREADSHEET_OPTIONS.to_s
|
44
|
-
SpreadsheetArchitect.to_xlsx(headers: [[1]], data: [[1]], header_style: {b: false}, row_style: {background_color: '000000'})
|
45
|
-
assert_equal(x, CustomPost::SPREADSHEET_OPTIONS.to_s)
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
def teardown
|
50
|
-
end
|
51
|
-
end
|
data/test/models/ods_test.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class OdsTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
FileUtils.mkdir_p(Rails.root.join('tmp/ods'))
|
7
|
-
|
8
|
-
10.times.each do
|
9
|
-
CustomPost.create(name: SecureRandom.hex, content: SecureRandom.hex, age: 2)
|
10
|
-
end
|
11
|
-
|
12
|
-
@headers = ['test1', 'test2','test3']
|
13
|
-
@data = [
|
14
|
-
['row1','test1'],
|
15
|
-
['row2 c1', nil, '123'],
|
16
|
-
['the',Date.today,Time.now]
|
17
|
-
]
|
18
|
-
@options = {
|
19
|
-
headers: true,
|
20
|
-
header_style: {background_color: 'AAAAAA', color: 'FFFFFF', align: :center, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
|
21
|
-
row_style: {background_color: nil, color: '000000', align: :left, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
|
22
|
-
sheet_name: 'My Project Export',
|
23
|
-
column_styles: [],
|
24
|
-
range_styles: [],
|
25
|
-
merges: [],
|
26
|
-
borders: [],
|
27
|
-
column_types: [:string, :date, :date]
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_empty_model
|
32
|
-
CustomPost.delete_all
|
33
|
-
File.open(Rails.root.join('tmp/ods/empty_model.ods'),'w+b') do |f|
|
34
|
-
f.write CustomPost.to_ods
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_empty_sa
|
39
|
-
File.open(Rails.root.join('tmp/ods/empty_sa.ods'),'w+b') do |f|
|
40
|
-
f.write SpreadsheetArchitect.to_ods(data: [])
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_sa
|
45
|
-
File.open(Rails.root.join('tmp/ods/sa.ods'),'w+b') do |f|
|
46
|
-
f.write SpreadsheetArchitect.to_ods(headers: @headers, data: @data)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_model
|
51
|
-
File.open(Rails.root.join('tmp/ods/model.ods'),'w+b') do |f|
|
52
|
-
f.write CustomPost.to_ods
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_options
|
57
|
-
File.open(Rails.root.join('tmp/ods/model_options.ods'),'w+b') do |f|
|
58
|
-
f.write CustomPost.to_ods(@options)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def teardown
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class PlainRubyObjectTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@path = Rails.root.join('tmp/plain_ruby_object')
|
7
|
-
FileUtils.mkdir_p(@path)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_csv
|
11
|
-
assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
|
12
|
-
PlainRubyObject.to_csv
|
13
|
-
end
|
14
|
-
|
15
|
-
instances = 3.times.map{|_| PlainRubyObject.new}
|
16
|
-
data = PlainRubyObject.to_csv(instances: instances)
|
17
|
-
|
18
|
-
File.open(File.join(@path, 'csv.csv'), 'w+b') do |f|
|
19
|
-
f.write data
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_ods
|
24
|
-
assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
|
25
|
-
PlainRubyObject.to_ods
|
26
|
-
end
|
27
|
-
|
28
|
-
instances = 3.times.map{|_| PlainRubyObject.new}
|
29
|
-
data = PlainRubyObject.to_ods(instances: instances)
|
30
|
-
|
31
|
-
File.open(File.join(@path, 'ods.ods'), 'w+b') do |f|
|
32
|
-
f.write data
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_xlsx
|
37
|
-
assert_raise SpreadsheetArchitect::Exceptions::NoInstancesError do
|
38
|
-
PlainRubyObject.to_xlsx
|
39
|
-
end
|
40
|
-
|
41
|
-
instances = 3.times.map{|_| PlainRubyObject.new}
|
42
|
-
data = PlainRubyObject.to_xlsx(instances: instances)
|
43
|
-
|
44
|
-
File.open(File.join(@path, 'xlsx.xlsx'), 'w+b') do |f|
|
45
|
-
f.write data
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def teardown
|
50
|
-
end
|
51
|
-
end
|
data/test/models/post_test.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
require "test_helper"
|
2
|
-
|
3
|
-
class PostTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@path = Rails.root.join('tmp/posts')
|
7
|
-
FileUtils.mkdir_p(@path)
|
8
|
-
end
|
9
|
-
|
10
|
-
def test_csv
|
11
|
-
data = Post.to_csv
|
12
|
-
|
13
|
-
File.open(File.join(@path, 'csv.csv'), 'w+b') do |f|
|
14
|
-
f.write data
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_ods
|
19
|
-
data = Post.to_ods
|
20
|
-
|
21
|
-
File.open(File.join(@path, 'ods.ods'), 'w+b') do |f|
|
22
|
-
f.write data
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_xlsx
|
27
|
-
data = Post.all.to_xlsx
|
28
|
-
|
29
|
-
File.open(File.join(@path, 'xlsx.xlsx'), 'w+b') do |f|
|
30
|
-
f.write data
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_empty
|
35
|
-
Post.destroy_all
|
36
|
-
|
37
|
-
File.open(File.join(@path, 'empty.xlsx'), 'w+b') do |f|
|
38
|
-
f.write Post.to_xlsx
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def teardown
|
43
|
-
end
|
44
|
-
end
|
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class SpreadsheetArchitectUtilsTest < ActiveSupport::TestCase
|
4
|
-
|
5
|
-
def setup
|
6
|
-
@headers = ['test1', 'test2','test3']
|
7
|
-
@data = [
|
8
|
-
['row1'],
|
9
|
-
['row2 c1', 'row2 c2'],
|
10
|
-
['the','data']
|
11
|
-
]
|
12
|
-
@options = {
|
13
|
-
headers: true,
|
14
|
-
header_style: {background_color: 'AAAAAA', color: 'FFFFFF', align: :center, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
|
15
|
-
row_style: {background_color: nil, color: '000000', align: :left, font_name: 'Arial', font_size: 10, bold: false, italic: false, underline: false},
|
16
|
-
sheet_name: 'My Project Export',
|
17
|
-
column_styles: [],
|
18
|
-
range_styles: [],
|
19
|
-
merges: [],
|
20
|
-
borders: [],
|
21
|
-
column_types: [],
|
22
|
-
data: []
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_constants_dont_change
|
27
|
-
x = SpreadsheetArchitect.default_options.to_s
|
28
|
-
SpreadsheetArchitect.to_xlsx(headers: [[1]], data: [[1]], header_style: {b: false}, row_style: {background_color: '000000'})
|
29
|
-
assert_equal(x, SpreadsheetArchitect.default_options.to_s)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_str_humanize
|
33
|
-
assert_equal(SpreadsheetArchitect::Utils.str_humanize('my_project_export'), 'My Project Export')
|
34
|
-
assert_equal(SpreadsheetArchitect::Utils.str_humanize('My Project Export'), 'My Project Export')
|
35
|
-
assert_equal(SpreadsheetArchitect::Utils.str_humanize('TBS report'), 'TBS Report')
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_get_type
|
39
|
-
assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type('string'), :string)
|
40
|
-
assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(123.01), :float)
|
41
|
-
assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(BigDecimal('123.01')), :float)
|
42
|
-
assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(10), :integer)
|
43
|
-
assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(:test), :string)
|
44
|
-
assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(Time.now.to_date), :date)
|
45
|
-
assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(DateTime.now), :time)
|
46
|
-
assert_equal(SpreadsheetArchitect::Utils::XLSX.get_type(Time.now), :time)
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_get_cell_data
|
50
|
-
SpreadsheetArchitect::Utils.get_cell_data(@options, SpreadsheetArchitect)
|
51
|
-
|
52
|
-
SpreadsheetArchitect::Utils.get_cell_data(@options, Post)
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_get_options
|
56
|
-
SpreadsheetArchitect::Utils.get_options(@options, SpreadsheetArchitect)
|
57
|
-
|
58
|
-
SpreadsheetArchitect::Utils.get_options(@options, Post)
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_convert_styles_to_axlsx
|
62
|
-
xlsx_styles = SpreadsheetArchitect::Utils::XLSX.convert_styles_to_axlsx({background_color: '333333', color: '000000', align: true, bold: true, font_size: 14, italic: true, underline: true, test: true})
|
63
|
-
assert_equal(xlsx_styles, {bg_color: '333333', fg_color: '000000', alignment: {horizontal: true}, b: true, sz: 14, i: true, u: true, test: true})
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_convert_styles_to_ods
|
67
|
-
ods_styles = SpreadsheetArchitect::Utils.convert_styles_to_ods({background_color: '333333', color: '000000', align: true, bold: true, font_size: 14, italic: true, underline: true, test: true})
|
68
|
-
assert_equal(ods_styles, {'cell' => {'background-color' => '#333333'}, 'text' => {'color' => '#000000', 'align' => true, 'font-weight' => 'bold', 'font-size' => 14, 'font-style' => 'italic', 'text-underline-type' => 'single', 'text-underline-style' => 'solid'}})
|
69
|
-
end
|
70
|
-
|
71
|
-
def teardown
|
72
|
-
end
|
73
|
-
end
|