ncs_mdes_warehouse 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  NCS Navigator MDES Warehouse History
2
2
  ====================================
3
3
 
4
+ 0.13.1
5
+ ------
6
+
7
+ - Fix XmlEmitter#models so that it returns the configured models if available.
8
+ This was broken in 0.13.0. (#3984)
9
+
4
10
  0.13.0
5
11
  ------
6
12
 
@@ -1,5 +1,5 @@
1
1
  module NcsNavigator
2
2
  module Warehouse
3
- VERSION = '0.13.0'
3
+ VERSION = '0.13.1'
4
4
  end
5
5
  end
@@ -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
- config.before(:each, :use_database) do
71
- $db_init ||=
72
- begin
73
- init = NcsNavigator::Warehouse::DatabaseInitializer.new(spec_config)
74
- init.set_up_repository(:both)
75
- end
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.0
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-04-30 00:00:00.000000000 Z
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: 2914256523883206240
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: 2914256523883206240
3012
+ hash: 4557343554488518781
3013
3013
  requirements: []
3014
3014
  rubyforge_project:
3015
3015
  rubygems_version: 1.8.25