iqvoc 4.17.0 → 4.17.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f67e560f1aac50c13bd28d33a5929ac876f297bda3e023c3474f728c397bfba
4
- data.tar.gz: '0818c7dfe12e3b7fd16fcf9098871d3fa1d50859c03f5264a4665ec8a8e840c7'
3
+ metadata.gz: a001300613ef498c4e3cbbaefbc35f5fc9735722141abe70b388c05c5ba3497f
4
+ data.tar.gz: 9baf18c868cb4c69e392bd4e039b2e7d9e89faea13b7f595a705eb097b1549c8
5
5
  SHA512:
6
- metadata.gz: c5d7c4b4a4a3c79a9add3e8e350cdb021ff72bdeb620fa31622dca5c1848c963a94f75cce7547df16076de497a0bde490d07db348cec3ba198b8e24740fd1e7d
7
- data.tar.gz: 990188563110861ce3ad6a80095e772f003502e64bacf81a78c044ba4f7ac4a45648929ac01cc47e37b1372636bc2afbbaabb67069954939477293713fb577f5
6
+ metadata.gz: 8b6cf1be534f73a2ef802d6756a9c77b286aa1e8ca99511dfa0f91c3ce718a9c8a6c0d31b8a791ea8597ee7475117666442afff50a47c723b58d77c0793e64f0
7
+ data.tar.gz: 8a1f4f0eed380534d02c3fbf0831dc50854d0f878ed86bd66f75bcdcf50372db37bee646ceb91db267a1c29ba3a46ebee125d896217a51843e1de03dcb0f348b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [4.17.1]
2
+
3
+ * `Iqvoc.host_version` returns `nil` instead of raising if the host namespace has no `VERSION`
4
+ * instance configuration also rescues `ActiveRecord::NoDatabaseError` (e.g. on `db:create`)
5
+
1
6
  ## [4.17.0]
2
7
 
3
8
  * upgrade to Bootstrap v5 (and `bootstrap_form` v5)
@@ -206,10 +206,11 @@ module Iqvoc
206
206
  end
207
207
  end
208
208
 
209
+ # Version of the host application, `nil` if there is no host namespace or it does not
210
+ # define a `VERSION` constant.
209
211
  def host_version
210
- if Iqvoc.host_namespace
211
- Iqvoc.host_namespace::VERSION
212
- end
212
+ namespace = Iqvoc.host_namespace
213
+ namespace::VERSION if namespace&.const_defined?(:VERSION, false)
213
214
  end
214
215
  end
215
216
  end
@@ -109,7 +109,9 @@ module Iqvoc
109
109
  end
110
110
 
111
111
  @initialized = true
112
- rescue ActiveRecord::ConnectionNotEstablished
112
+ # no database yet, e.g. while the app boots for `rails db:create` or
113
+ # `db:prepare`: use the defaults and retry on next access
114
+ rescue ActiveRecord::ConnectionNotEstablished, ActiveRecord::NoDatabaseError
113
115
  false
114
116
  end
115
117
 
data/lib/iqvoc/version.rb CHANGED
@@ -15,5 +15,5 @@
15
15
  # limitations under the License.
16
16
 
17
17
  module Iqvoc
18
- VERSION = "4.17.0"
18
+ VERSION = "4.17.1"
19
19
  end
@@ -0,0 +1,31 @@
1
+ # encoding: UTF-8
2
+
3
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
4
+
5
+ class HostVersionTest < ActiveSupport::TestCase
6
+ setup do
7
+ @host_namespace = Iqvoc.host_namespace
8
+ end
9
+
10
+ teardown do
11
+ Iqvoc.host_namespace = @host_namespace
12
+ end
13
+
14
+ test 'host_version is nil without a host namespace' do
15
+ Iqvoc.host_namespace = nil
16
+
17
+ assert_nil Iqvoc.host_version
18
+ end
19
+
20
+ test 'host_version is the VERSION of the host namespace' do
21
+ Iqvoc.host_namespace = Module.new.tap { |m| m.const_set(:VERSION, '1.2.3') }
22
+
23
+ assert_equal '1.2.3', Iqvoc.host_version
24
+ end
25
+
26
+ test 'host_version is nil if the host namespace has no VERSION' do
27
+ Iqvoc.host_namespace = Module.new
28
+
29
+ assert_nil Iqvoc.host_version
30
+ end
31
+ end
@@ -15,6 +15,7 @@
15
15
  # limitations under the License.
16
16
 
17
17
  require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
18
+ require 'minitest/mock'
18
19
 
19
20
  class InstanceConfigurationBrowsingTest < ActiveSupport::TestCase
20
21
  setup do
@@ -48,6 +49,19 @@ class InstanceConfigurationBrowsingTest < ActiveSupport::TestCase
48
49
  assert_nil @config['germany']
49
50
  end
50
51
 
52
+ test 'should fall back to defaults if the database does not exist yet' do
53
+ @config.register_setting('dragon', 'punch')
54
+ @config.instance_variable_set(:@initialized, false)
55
+
56
+ ConfigurationSetting.stub(:table_exists?, -> { raise ActiveRecord::NoDatabaseError }) do
57
+ assert_equal 'punch', @config['dragon']
58
+ end
59
+ assert_not @config.instance_variable_get(:@initialized)
60
+ ensure
61
+ @config.deregister_setting('dragon')
62
+ @config.initialize_cache
63
+ end
64
+
51
65
  test 'should validate values' do
52
66
  @config.register_setting('foo', 'bar')
53
67
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iqvoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.17.0
4
+ version: 4.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Glaser
@@ -981,6 +981,7 @@ files:
981
981
  - test/models/concept_scheme_test.rb
982
982
  - test/models/concept_test.rb
983
983
  - test/models/deep_cloning_test.rb
984
+ - test/models/host_version_test.rb
984
985
  - test/models/inline_data_test.rb
985
986
  - test/models/instance_configuration_test.rb
986
987
  - test/models/note_test.rb
@@ -1054,6 +1055,7 @@ test_files:
1054
1055
  - test/models/concept_scheme_test.rb
1055
1056
  - test/models/concept_test.rb
1056
1057
  - test/models/deep_cloning_test.rb
1058
+ - test/models/host_version_test.rb
1057
1059
  - test/models/inline_data_test.rb
1058
1060
  - test/models/instance_configuration_test.rb
1059
1061
  - test/models/note_test.rb