Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating sqlite3 version to 1.7 #32

Merged
merged 4 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion iev.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "relaton", "~> 1.18"
spec.add_dependency "ruby-prof"
spec.add_dependency "sequel", "~> 5.40"
spec.add_dependency "sqlite3", "~> 1.4.2"
spec.add_dependency "sqlite3", "~> 1.7.0"
spec.add_dependency "thor", "~> 1.0"
spec.add_dependency "zeitwerk", "~> 2.4"
end
2 changes: 2 additions & 0 deletions spec/acceptance/db2yaml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@

expect(concept2).to eq(expected_concept2)
expect(localized_concept2).to eq(expected_localized_concept2)

FileUtils.rm_rf(concepts_dir)
end
end
end
Expand Down
43 changes: 24 additions & 19 deletions spec/acceptance/xlsx2db_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,39 @@

RSpec.describe "IEV" do
let(:sample_xlsx_file) { fixture_path("sample-file.xlsx") }
let(:tmp_db_dir) { "tmp-db-dir" }

describe "xlsx2db" do
it "imports XLSX document to database" do
Dir.mktmpdir("iev-test") do |dir|
dbfile = "#{dir}/test.sqlite3"
command = %W(xlsx2db #{sample_xlsx_file} -o #{dbfile})
silence_output_streams { IEV::CLI.start(command) }
FileUtils.rm_rf(tmp_db_dir) if Dir.exist?(tmp_db_dir)

expect(dbfile).to satisfy { |p| File.file? p }
Dir.mkdir tmp_db_dir

db = SQLite3::Database.new(dbfile)
dbfile = File.join(tmp_db_dir, "test.sqlite3")
command = %W(xlsx2db #{sample_xlsx_file} -o #{dbfile})
silence_output_streams { IEV::CLI.start(command) }

sql = <<~SQL
select count(*)
from concepts
where language = 'en'
SQL
expect(dbfile).to satisfy { |p| File.file? p }

expect(db.execute(sql).first.first).to eq(2)
db = SQLite3::Database.new(dbfile)

sql = <<~SQL
select term
from concepts
where language = 'en' and ievref = '103-01-01'
SQL
sql = <<~SQL
select count(*)
from concepts
where language = 'en'
SQL

expect(db.execute(sql).first.first).to eq("function")
end
expect(db.execute(sql).first.first).to eq(2)

sql = <<~SQL
select term
from concepts
where language = 'en' and ievref = '103-01-01'
SQL

expect(db.execute(sql).first.first).to eq("function")

FileUtils.rm_rf(tmp_db_dir)
end
end
end
2 changes: 2 additions & 0 deletions spec/acceptance/xlsx2yaml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@

expect(concept2).to eq(expected_concept2)
expect(localized_concept2).to eq(expected_localized_concept2)

FileUtils.rm_rf(concepts_dir)
end
end
end
Expand Down
Loading