ncs_mdes 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ module NcsNavigator::Mdes
9
9
  attr_accessor :final_category
10
10
  attr_accessor :sub_category
11
11
  attr_accessor :disposition
12
+ attr_accessor :category_code
12
13
  attr_accessor :interim_code
13
14
  attr_accessor :final_code
14
15
 
@@ -18,11 +19,20 @@ module NcsNavigator::Mdes
18
19
  #
19
20
  # @return [DispositionCode] the created instance.
20
21
  def initialize(attrs)
21
- [:event, :final_category, :sub_category, :disposition, :interim_code, :final_code].each do |a|
22
- self.send("#{a}=", attrs[a.to_s])
22
+ %w(event final_category sub_category disposition category_code interim_code final_code).each do |a|
23
+ self.send("#{a}=", attrs[a])
23
24
  end
24
25
  end
25
26
 
27
+ ##
28
+ # If the code's final category signifies successful completion, returns
29
+ # true; otherwise, returns false.
30
+ #
31
+ # @return [Boolean]
32
+ def success?
33
+ final_category.to_s.start_with?('Complete')
34
+ end
35
+
26
36
  ##
27
37
  # Provides a briefer inspection for cleaner IRB use.
28
38
  #
@@ -31,4 +41,4 @@ module NcsNavigator::Mdes
31
41
  "\#<#{self.class} event=#{event.inspect} disposition=#{disposition.inspect} status_code=#{interim_code.inspect}/#{final_code.inspect}>"
32
42
  end
33
43
  end
34
- end
44
+ end
@@ -1,5 +1,5 @@
1
1
  module NcsNavigator
2
2
  module Mdes
3
- VERSION = '0.7.0'
3
+ VERSION = '0.8.0'
4
4
  end
5
5
  end
@@ -0,0 +1,39 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ module NcsNavigator::Mdes
4
+ describe DispositionCode do
5
+ let(:code) { DispositionCode.new({}) }
6
+
7
+ describe '#success?' do
8
+ describe 'if #final_category starts with "Complete"' do
9
+ before do
10
+ code.final_category = 'Complete Interview'
11
+ end
12
+
13
+ it 'returns true' do
14
+ code.should be_success
15
+ end
16
+ end
17
+
18
+ describe 'if #final_category does not start with "Complete"' do
19
+ before do
20
+ code.final_category = 'Eligible Non-Interview'
21
+ end
22
+
23
+ it 'returns false' do
24
+ code.should_not be_success
25
+ end
26
+ end
27
+
28
+ describe 'if #final_category is nil' do
29
+ before do
30
+ code.final_category = nil
31
+ end
32
+
33
+ it 'returns false' do
34
+ code.should_not be_success
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncs_mdes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
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: 2012-06-15 00:00:00.000000000 Z
12
+ date: 2012-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -142,6 +142,7 @@ files:
142
142
  - lib/ncs_navigator/mdes/variable_type.rb
143
143
  - lib/ncs_navigator/mdes/version.rb
144
144
  - ncs_mdes.gemspec
145
+ - spec/ncs_navigator/mdes/disposition_code_spec.rb
145
146
  - spec/ncs_navigator/mdes/source_documents_spec.rb
146
147
  - spec/ncs_navigator/mdes/specification_spec.rb
147
148
  - spec/ncs_navigator/mdes/transmission_table_spec.rb
@@ -162,19 +163,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
163
  - - ! '>='
163
164
  - !ruby/object:Gem::Version
164
165
  version: '0'
166
+ segments:
167
+ - 0
168
+ hash: -3892920611688872605
165
169
  required_rubygems_version: !ruby/object:Gem::Requirement
166
170
  none: false
167
171
  requirements:
168
172
  - - ! '>='
169
173
  - !ruby/object:Gem::Version
170
174
  version: '0'
175
+ segments:
176
+ - 0
177
+ hash: -3892920611688872605
171
178
  requirements: []
172
179
  rubyforge_project:
173
- rubygems_version: 1.8.21
180
+ rubygems_version: 1.8.24
174
181
  signing_key:
175
182
  specification_version: 3
176
183
  summary: A ruby API for various versions of the NCS MDES.
177
184
  test_files:
185
+ - spec/ncs_navigator/mdes/disposition_code_spec.rb
178
186
  - spec/ncs_navigator/mdes/source_documents_spec.rb
179
187
  - spec/ncs_navigator/mdes/specification_spec.rb
180
188
  - spec/ncs_navigator/mdes/transmission_table_spec.rb