Skip to content

Commit

Permalink
revert: TestData (#1009)
Browse files Browse the repository at this point in the history
  • Loading branch information
askonev authored Dec 8, 2023
1 parent 4e6b98a commit 98ed4b7
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 37 deletions.
8 changes: 4 additions & 4 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-11-28 10:56:01 UTC using RuboCop version 1.57.2.
# on 2023-12-05 12:17:16 UTC using RuboCop version 1.58.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 4
# Offense count: 3
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
Max: 21
Max: 16

# Offense count: 121
# Offense count: 126
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 21
Expand Down
29 changes: 29 additions & 0 deletions lib/doc_builder_static_data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

# module for doc builder static data
module DocBuilderStaticData
# Default style list in the CDE
DEFAULT_STYLES = [
'Normal',
'No Spacing',
'Heading 1',
'Heading 2',
'Heading 3',
'Heading 4',
'Heading 5',
'Heading 6',
'Heading 7',
'Heading 8',
'Heading 9',
'Title',
'Subtitle',
'Quote',
'Intense Quote',
'List Paragraph',
'Caption',
'Header',
'Footer',
'Footnote text',
'Endnote text'
].freeze
end
1 change: 1 addition & 0 deletions lib/doc_builder_testing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'tempfile'
require 'ooxml_parser'
require 'onlyoffice_pdf_parser'
require_relative 'doc_builder_static_data'
require_relative 'doc_builder_testing/exceptions'
require_relative 'doc_builder_testing/doc_builder_wrapper'
require_relative 'doc_builder_testing/web_doc_builder_wrapper'
2 changes: 1 addition & 1 deletion spec/doc_builder_wrapper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
end

describe 'check windows build libs', :win do
DocBuilderStaticData.libs.each do |lib|
TestData.libs.each do |lib|
it lib.to_s do
skip('[WIN] check build libs') unless Gem.win_platform?
expect(arr_libs).to include(lib)
Expand Down
2 changes: 1 addition & 1 deletion spec/docx/smoke/api_style_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
it 'ApiStyle | ToJSON method' do
docx = builder.build_and_parse('js/docx/smoke/api_style/to_json.js')
json = JSON.parse(docx.elements[22].nonempty_runs[0].text)
DocBuilderStaticData.cde_styles.each_with_index do |style, index|
DocBuilderStaticData::DEFAULT_STYLES.each_with_index do |style, index|
# TODO: To understand why incorrect names are recorded
next if (style == 'Header') || # in the metadata: Custom_Style 719 styleId: 42
(style == 'Footer') || # in the metadata: Custom_Style 725 styleId: 44
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

Encoding.default_external = Encoding::UTF_8
require 'bundler/setup'
require 'rspec'
require 'test_data'
require 'bundler/setup'
require_relative '../lib/doc_builder_testing'
require_relative 'doc_builder_static_data'

# Get either DocBuilder of WebDocBuilder
# depending of env var
Expand Down
28 changes: 1 addition & 27 deletions spec/doc_builder_static_data.rb → spec/test_data.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# Test data for autotest
module DocBuilderStaticData
module TestData
# CDE number formats (7.4.0)
# @return [Array<String (frozen)>]
def self.number_formats
Expand All @@ -18,32 +18,6 @@ def self.number_formats
'0.00E+00'].freeze
end

# Default style list for CDE v7.4.1
# @return [Array<String (frozen)>]
def self.cde_styles
['Normal',
'No Spacing',
'Heading 1',
'Heading 2',
'Heading 3',
'Heading 4',
'Heading 5',
'Heading 6',
'Heading 7',
'Heading 8',
'Heading 9',
'Title',
'Subtitle',
'Quote',
'Intense Quote',
'List Paragraph',
'Caption',
'Header',
'Footer',
'Footnote text',
'Endnote text'].freeze
end

# @return [Array<String (frozen)>]
def self.libs
%w[DjVuFile.dll
Expand Down
4 changes: 2 additions & 2 deletions spec/xlsx/smoke/api_range_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

it 'ApiRange | NumberFormat method' do
xlsx = builder.build_and_parse('js/xlsx/smoke/api_range/setter_number_format.js')
DocBuilderStaticData.number_formats.each_with_index do |format, i|
TestData.number_formats.each_with_index do |format, i|
expect(xlsx.worksheets.first.rows[i + 1].cells[0].raw_text).to eq('123456')
expect(xlsx.worksheets.first.rows[i + 1].cells[0].style.numerical_format).to eq(format)
end
Expand All @@ -88,7 +88,7 @@

it 'ApiRange | GetNumberFormat' do
xlsx = builder.build_and_parse('js/xlsx/smoke/api_range/get_number_format.js')
DocBuilderStaticData.number_formats.each_with_index do |format, i|
TestData.number_formats.each_with_index do |format, i|
expect(xlsx.worksheets.first.rows[i + 1].cells[2].raw_text).to eq('123456')
expect(xlsx.worksheets.first.rows[i + 1].cells[2].style.numerical_format).to eq(format)
end
Expand Down

0 comments on commit 98ed4b7

Please sign in to comment.