ncs_mdes_warehouse 0.13.0 → 0.13.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.
data/CHANGELOG.md
CHANGED
@@ -19,12 +19,6 @@ module NcsNavigator::Warehouse
|
|
19
19
|
# emitter.
|
20
20
|
attr_reader :configuration
|
21
21
|
|
22
|
-
##
|
23
|
-
# @return [Array<Models::MdesModel>] the models whose data will be
|
24
|
-
# emitted. This is determined from the `:tables` option to
|
25
|
-
# {#initialize}.
|
26
|
-
attr_reader :models
|
27
|
-
|
28
22
|
##
|
29
23
|
# @private exposed for testing
|
30
24
|
# @return [Array] the configuration objects related to each separate XML
|
@@ -140,6 +134,15 @@ XML
|
|
140
134
|
end
|
141
135
|
end
|
142
136
|
|
137
|
+
##
|
138
|
+
# @return [Array<Models::MdesModel>] the models whose data will be
|
139
|
+
# emitted. This is determined from the `:tables` option to
|
140
|
+
# {#initialize} or by any `models` method implemented by the value passed
|
141
|
+
# to the `:content` option.
|
142
|
+
def models
|
143
|
+
@content_enumerator.models if @content_enumerator.respond_to?(:models)
|
144
|
+
end
|
145
|
+
|
143
146
|
##
|
144
147
|
# Emit XML from the configured warehouse to {#filename}.
|
145
148
|
#
|
@@ -32,6 +32,28 @@ module NcsNavigator::Warehouse
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
describe '#models' do
|
36
|
+
it 'exposes the configured list of models when no :content' do
|
37
|
+
options[:tables] = %w(person household_unit)
|
38
|
+
emitter.models.should == [mdes_model(:person), mdes_model(:household_unit)]
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'uses the models from the provided :content, if any' do
|
42
|
+
content = mock(Enumerable)
|
43
|
+
content.should_receive(:models).and_return([mdes_model(:listing_unit)])
|
44
|
+
options[:content] = content
|
45
|
+
|
46
|
+
options[:tables] = %w(person household_unit)
|
47
|
+
|
48
|
+
emitter.models.should == [mdes_model(:listing_unit)]
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'is nil if the :content does not provide models' do
|
52
|
+
options[:content] = []
|
53
|
+
emitter.models.should be_nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
35
57
|
# Most of the details of the XML are tested on the MdesModel mixin
|
36
58
|
describe 'the generated XML', :slow do
|
37
59
|
describe 'global attributes' do
|
data/spec/spec_helper.rb
CHANGED
@@ -67,12 +67,12 @@ RSpec.configure do |config|
|
|
67
67
|
|
68
68
|
###### use_database
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
70
|
+
# Other specs call set_up_repository with different warehouse configs.
|
71
|
+
# This interferes with global state (DM's connection setup), so we need
|
72
|
+
# to reconnect for each :use_database group to correct.
|
73
|
+
config.before(:all, :use_database) do
|
74
|
+
init = NcsNavigator::Warehouse::DatabaseInitializer.new(spec_config)
|
75
|
+
init.set_up_repository(:both)
|
76
76
|
end
|
77
77
|
|
78
78
|
config.after(:each, :use_database) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ncs_mdes_warehouse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.
|
4
|
+
version: 0.13.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ncs_mdes
|
@@ -3000,7 +3000,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
3000
3000
|
version: '0'
|
3001
3001
|
segments:
|
3002
3002
|
- 0
|
3003
|
-
hash:
|
3003
|
+
hash: 4557343554488518781
|
3004
3004
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
3005
3005
|
none: false
|
3006
3006
|
requirements:
|
@@ -3009,7 +3009,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
3009
3009
|
version: '0'
|
3010
3010
|
segments:
|
3011
3011
|
- 0
|
3012
|
-
hash:
|
3012
|
+
hash: 4557343554488518781
|
3013
3013
|
requirements: []
|
3014
3014
|
rubyforge_project:
|
3015
3015
|
rubygems_version: 1.8.25
|