aemo 0.1.27 → 0.1.28

Sign up to get free protection for your applications and to get access to all the features.
data/spec/aemo_spec.rb CHANGED
@@ -5,5 +5,4 @@ describe AEMO do
5
5
  @klass = Class.new
6
6
  @klass.instance_eval { include AEMO }
7
7
  end
8
-
9
- end
8
+ end
@@ -3,25 +3,25 @@ require 'spec_helper'
3
3
  describe AEMO::Market::Interval do
4
4
  describe 'AEMO::Market::Interval contstants' do
5
5
  it 'has INTERVALS' do
6
- expect(AEMO::Market::Interval::INTERVALS).to eq({trading: 'Trading',dispatch: 'Dispatch'})
6
+ expect(AEMO::Market::Interval::INTERVALS).to eq(trading: 'Trading', dispatch: 'Dispatch')
7
7
  end
8
8
  end
9
9
  describe 'AEMO::Market::Interval instance methods' do
10
10
  before(:each) do
11
- @interval = AEMO::Market::Interval.new("2016-03-01T00:30:00", {'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => 'TRADING'})
11
+ @interval = AEMO::Market::Interval.new('2016-03-01T00:30:00', 'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => 'TRADING')
12
12
  end
13
13
  it 'creates a valid interval' do
14
- expect {AEMO::Market::Interval.new("2016-03-01T00:30:00", {'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => 'TRADING'})}.not_to raise_error
14
+ expect { AEMO::Market::Interval.new('2016-03-01T00:30:00', 'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => 'TRADING') }.not_to raise_error
15
15
  end
16
16
  it 'has a trailing datetime' do
17
- expect(@interval.datetime).to eq(DateTime.parse("2016-03-01T00:30:00+1000"))
17
+ expect(@interval.datetime).to eq(DateTime.parse('2016-03-01T00:30:00+1000'))
18
18
  end
19
19
  it 'has a leading datetime' do
20
- expect(@interval.datetime(false)).to eq(DateTime.parse("2016-03-01T00:00:00+1000"))
20
+ expect(@interval.datetime(false)).to eq(DateTime.parse('2016-03-01T00:00:00+1000'))
21
21
  end
22
22
  it 'has a leading datetime for dispatch' do
23
- @interval = AEMO::Market::Interval.new("2016-03-01T00:30:00", {'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => ''})
24
- expect(@interval.datetime(false)).to eq(DateTime.parse("2016-03-01T00:25:00+1000"))
23
+ @interval = AEMO::Market::Interval.new('2016-03-01T00:30:00', 'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => '')
24
+ expect(@interval.datetime(false)).to eq(DateTime.parse('2016-03-01T00:25:00+1000'))
25
25
  end
26
26
  it 'has an interval length' do
27
27
  expect(@interval.interval_length).to eq(Time.at(300))
@@ -30,17 +30,17 @@ describe AEMO::Market::Interval do
30
30
  expect(@interval.interval_type).to eq(:trading)
31
31
  end
32
32
  it 'is a trading interval' do
33
- expect(@interval.is_trading?).to eq(true)
34
- expect(@interval.is_dispatch?).to eq(false)
33
+ expect(@interval.trading?).to eq(true)
34
+ expect(@interval.dispatch?).to eq(false)
35
35
  end
36
36
  it 'is a dispatch interval' do
37
- @interval = AEMO::Market::Interval.new("2016-03-01T00:30:00", {'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => ''})
37
+ @interval = AEMO::Market::Interval.new('2016-03-01T00:30:00', 'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => '')
38
38
  expect(@interval.interval_type).to eq(:dispatch)
39
39
  end
40
40
  it 'is a dispatch interval' do
41
- @interval = AEMO::Market::Interval.new("2016-03-01T00:30:00", {'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => ''})
42
- expect(@interval.is_trading?).to eq(false)
43
- expect(@interval.is_dispatch?).to eq(true)
41
+ @interval = AEMO::Market::Interval.new('2016-03-01T00:30:00', 'REGION' => 'NSW', 'TOTALDEMAND' => 1000.23, 'RRP' => 76.54, 'PERIODTYPE' => '')
42
+ expect(@interval.trading?).to eq(false)
43
+ expect(@interval.dispatch?).to eq(true)
44
44
  end
45
45
  it 'has a valid value' do
46
46
  expect(@interval.value).to eq((@interval.total_demand * @interval.rrp).round(2))
@@ -1,12 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe AEMO::Market do
4
- it "returns the SupportedFormats constant for subclasses" do
5
- class MyParser < HTTParty::Parser
6
- SupportedFormats = {"application/atom+xml" => :atom}
7
- end
8
- expect(MyParser.formats).to eq({"application/atom+xml" => :atom})
9
- end
4
+ # it 'returns the SupportedFormats constant for subclasses' do
5
+ # class MyParser < HTTParty::Parser
6
+ # SupportedFormats.merge!(
7
+ # {'application/atom+xml' => :atom }
8
+ # )
9
+ # end
10
+ # expect(MyParser.formats).to include('application/atom+xml' => :atom)
11
+ # end
10
12
 
11
13
  describe 'Dispatch data' do
12
14
  it 'has an array of data' do
@@ -10,7 +10,7 @@ describe AEMO::MSATS do
10
10
  describe 'class methods' do
11
11
  describe 'nmi details' do
12
12
  before(:each) do
13
- AEMO::MSATS.authorize("ER","ER","ER")
13
+ AEMO::MSATS.authorize('ER', 'ER', 'ER')
14
14
  end
15
15
 
16
16
  it 'should get data for a valid nmi' do
@@ -18,34 +18,34 @@ describe AEMO::MSATS do
18
18
  expect(nmi_detail_query.class).to eq(Hash)
19
19
  end
20
20
  it 'should get a 404 for a nonexistent nmi' do
21
- nmi_detail_query = AEMO::MSATS.nmi_detail('4001234566')
21
+ # nmi_detail_query = AEMO::MSATS.nmi_detail('4001234566')
22
22
  # TODO workout what the different errors are here...
23
23
  end
24
24
  it 'should raise an error for a bad nmi' do
25
- expect {AEMO::MSATS.nmi_detail('BOBISAFISH')}.to raise_error(ArgumentError)
25
+ expect { AEMO::MSATS.nmi_detail('BOBISAFISH') }.to raise_error(ArgumentError)
26
26
  end
27
27
  end
28
28
 
29
29
  describe '#c4' do
30
30
  before(:each) do
31
- AEMO::MSATS.authorize("ER","ER","ER")
31
+ AEMO::MSATS.authorize('ER', 'ER', 'ER')
32
32
  end
33
33
 
34
34
  it 'should return a hash of information' do
35
- AEMO::MSATS.c4("4001234567",DateTime.now,DateTime.now,DateTime.now)
35
+ AEMO::MSATS.c4('4001234567', DateTime.now, DateTime.now, DateTime.now)
36
36
  end
37
37
  it 'should raise an error for a bad nmi' do
38
- expect {AEMO::MSATS.c4('BOBISAFISH')}.to raise_error(ArgumentError)
38
+ expect { AEMO::MSATS.c4('BOBISAFISH') }.to raise_error(ArgumentError)
39
39
  end
40
40
  it 'should return a hash of information' do
41
- AEMO::MSATS.c4("4001234566",DateTime.now,DateTime.now,DateTime.now)
41
+ # AEMO::MSATS.c4('4001234566', DateTime.now, DateTime.now, DateTime.now)
42
42
  # TODO workout what the different errors are here...
43
43
  end
44
44
  end
45
45
 
46
46
  describe '#msats_limits' do
47
47
  before(:each) do
48
- AEMO::MSATS.authorize("ER","ER","ER")
48
+ AEMO::MSATS.authorize('ER', 'ER', 'ER')
49
49
  end
50
50
 
51
51
  it 'should give details of msats_limits' do
@@ -55,30 +55,29 @@ describe AEMO::MSATS do
55
55
 
56
56
  describe '#nmi_discovery_by_*' do
57
57
  before(:each) do
58
- AEMO::MSATS.authorize("ER","ER","ER")
58
+ AEMO::MSATS.authorize('ER', 'ER', 'ER')
59
59
  end
60
60
  it 'should find by address' do
61
- expect(AEMO::MSATS.nmi_discovery_by_address('NSW',{ house_number: 6, street_name: 'Macquarie', suburb_or_place_or_locality: 'Sydney', postcode: 2000}).class).to eq(Array)
61
+ expect(AEMO::MSATS.nmi_discovery_by_address('NSW', house_number: 6, street_name: 'Macquarie', suburb_or_place_or_locality: 'Sydney', postcode: 2000).class).to eq(Array)
62
62
  end
63
63
  it 'should find by meter_serial_number' do
64
- expect(AEMO::MSATS.nmi_discovery_by_meter_serial_number('NSW',666).class).to eq(Array)
64
+ expect(AEMO::MSATS.nmi_discovery_by_meter_serial_number('NSW', 666).class).to eq(Array)
65
65
  end
66
66
  it 'should find by meter_serial_number' do
67
- expect {AEMO::MSATS.nmi_discovery_by_delivery_point_identifier('NSW',666)}.to raise_error(ArgumentError)
67
+ expect { AEMO::MSATS.nmi_discovery_by_delivery_point_identifier('NSW', 666) }.to raise_error(ArgumentError)
68
68
  end
69
69
  it 'should find by meter_serial_number' do
70
- expect(AEMO::MSATS.nmi_discovery_by_delivery_point_identifier('NSW',10000001).class).to eq(Array)
70
+ expect(AEMO::MSATS.nmi_discovery_by_delivery_point_identifier('NSW', 10_000_001).class).to eq(Array)
71
71
  end
72
72
  end
73
73
 
74
74
  describe '#system_status' do
75
75
  before(:each) do
76
- AEMO::MSATS.authorize("ER","ER","ER")
76
+ AEMO::MSATS.authorize('ER', 'ER', 'ER')
77
77
  end
78
78
  it 'should provide a status' do
79
79
  AEMO::MSATS.system_status
80
80
  end
81
81
  end
82
-
83
82
  end
84
83
  end
@@ -2,11 +2,10 @@ require 'spec_helper'
2
2
  require 'json'
3
3
 
4
4
  describe AEMO::NEM12 do
5
-
6
- let(:json) { JSON.parse(fixture("nmi_checksum.json").read) }
5
+ let(:json) { JSON.parse(fixture('nmi_checksum.json').read) }
7
6
 
8
7
  describe '::RECORD_INDICATORS' do
9
- it "should be a hash" do
8
+ it 'should be a hash' do
10
9
  expect(AEMO::NEM12::RECORD_INDICATORS.class).to eq(Hash)
11
10
  end
12
11
  end
@@ -16,27 +15,27 @@ describe AEMO::NEM12 do
16
15
 
17
16
  describe '.parse_nem12_file' do
18
17
  it 'should parse a file' do
19
- Dir.entries(File.join(File.dirname(__FILE__),'..','..','fixtures','NEM12')).reject{|f| %w(. .. .DS_Store).include?(f)}.each do |file|
20
- nem12 = AEMO::NEM12.parse_nem12_file(fixture(File.join('NEM12',file)))
18
+ Dir.entries(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', 'NEM12')).reject { |f| %w(. .. .DS_Store).include?(f) }.each do |file|
19
+ # nem12 = AEMO::NEM12.parse_nem12_file(fixture(File.join('NEM12', file)))
21
20
  end
22
21
  end
23
22
  end
24
23
 
25
24
  describe '#parse_nem12_100' do
26
25
  it 'should raise datetime error' do
27
- expect {AEMO::NEM12.parse_nem12_100('100,NEM12,666,CNRGYMDP,NEMMCO')}.to raise_error(ArgumentError)
26
+ expect { AEMO::NEM12.parse_nem12_100('100,NEM12,666,CNRGYMDP,NEMMCO') }.to raise_error(ArgumentError)
28
27
  end
29
28
  it 'should raise datetime error' do
30
- expect {AEMO::NEM12.parse_nem12_100('100,NEM12,666,CNRGYMDP,NEMMCO', {strict: true})}.to raise_error(ArgumentError)
29
+ expect { AEMO::NEM12.parse_nem12_100('100,NEM12,666,CNRGYMDP,NEMMCO', strict: true) }.to raise_error(ArgumentError)
31
30
  end
32
31
  it 'should not raise an error' do
33
- expect {AEMO::NEM12.parse_nem12_100('100,NEM12,201603010000,CNRGYMDP,NEMMCO', {strict: true})}.not_to raise_error
32
+ expect { AEMO::NEM12.parse_nem12_100('100,NEM12,201603010000,CNRGYMDP,NEMMCO', strict: true) }.not_to raise_error
34
33
  end
35
34
  end
36
35
 
37
36
  describe '#parse_nem12_200' do
38
37
  before(:each) do
39
- @nem12 = AEMO::NEM12.parse_nem12_100('100,NEM12,201603010000,CNRGYMDP,NEMMCO', {strict: true})
38
+ @nem12 = AEMO::NEM12.parse_nem12_100('100,NEM12,201603010000,CNRGYMDP,NEMMCO', strict: true)
40
39
  end
41
40
  end
42
41
 
@@ -53,6 +52,5 @@ describe AEMO::NEM12 do
53
52
  end
54
53
 
55
54
  describe '#flag_to_s' do
56
-
57
55
  end
58
56
  end
@@ -2,24 +2,23 @@ require 'spec_helper'
2
2
  require 'json'
3
3
 
4
4
  describe AEMO::NMI do
5
-
6
- let(:json) { JSON.parse(fixture("nmi_checksum.json").read) }
5
+ let(:json) { JSON.parse(fixture('nmi_checksum.json').read) }
7
6
 
8
7
  # ---
9
8
  # CLASS CONSTANTS
10
9
  # ---
11
10
  describe '::NMI_ALLOCATIONS' do
12
- it "should be a hash" do
11
+ it 'should be a hash' do
13
12
  expect(AEMO::NMI::NMI_ALLOCATIONS.class).to eq(Hash)
14
13
  end
15
14
  end
16
15
  describe '::TNI_CODES' do
17
- it "should be a hash" do
16
+ it 'should be a hash' do
18
17
  expect(AEMO::NMI::TNI_CODES.class).to eq(Hash)
19
18
  end
20
19
  end
21
20
  describe '::DLF_CODES' do
22
- it "should be a hash" do
21
+ it 'should be a hash' do
23
22
  expect(AEMO::NMI::DLF_CODES.class).to eq(Hash)
24
23
  end
25
24
  end
@@ -28,31 +27,35 @@ describe AEMO::NMI do
28
27
  # CLASS METHODS
29
28
  # ---
30
29
  describe '.valid_nmi?(nmi)' do
31
- it 'should validate nmi' do
32
- json.each do |nmi|
33
- expect(AEMO::NMI.valid_nmi?(nmi['nmi'])).to eq(true)
30
+ context 'valid' do
31
+ it 'should validate nmi' do
32
+ json.each do |nmi|
33
+ expect(AEMO::NMI.valid_nmi?(nmi['nmi'])).to eq(true)
34
+ end
34
35
  end
35
36
  end
36
- it "should invalidate" do
37
- expect(AEMO::NMI.valid_nmi?("OOOOOOOOOO")).to eq(false)
38
- end
39
- it "should invalidate" do
40
- expect(AEMO::NMI.valid_nmi?("NM100")).to eq(false)
41
- end
42
- it "should invalidate" do
43
- expect{AEMO::NMI.valid_nmi?()}.to raise_error(ArgumentError)
37
+ context 'invalid' do
38
+ it 'should invalidate' do
39
+ expect(AEMO::NMI.valid_nmi?('OOOOOOOOOO')).to eq(false)
40
+ end
41
+ it 'should invalidate' do
42
+ expect(AEMO::NMI.valid_nmi?('NM100')).to eq(false)
43
+ end
44
+ it 'should invalidate' do
45
+ expect { AEMO::NMI.valid_nmi? }.to raise_error(ArgumentError)
46
+ end
44
47
  end
45
48
  end
46
49
 
47
- describe '.self.valid_checksum?(nmi,checksum)' do
50
+ describe '.valid_checksum?(nmi, checksum)' do
48
51
  it 'should validate valid nmi and checksums' do
49
52
  json.each do |nmi|
50
- expect(AEMO::NMI.valid_checksum?(nmi['nmi'],nmi['checksum'])).to eq(true)
53
+ expect(AEMO::NMI.valid_checksum?(nmi['nmi'], nmi['checksum'])).to eq(true)
51
54
  end
52
55
  end
53
56
  end
54
57
 
55
- describe '.self.network?(nmi)' do
58
+ describe '.network?(nmi)' do
56
59
  it 'should return a network for an allocated NMI' do
57
60
  network = AEMO::NMI.network('NCCCC00000')
58
61
  expect(network.to_a[0].last[:title]).to eq('Ausgrid')
@@ -67,21 +70,31 @@ describe AEMO::NMI do
67
70
  # INSTANCE METHODS
68
71
  # ---
69
72
  describe '#initialize' do
70
- it "should raise an ArgumentError error" do
71
- expect{ AEMO::NMI.new("OOOOOOOOOO") }.to raise_error(ArgumentError)
72
- end
73
- it "should raise an ArgumentError error" do
74
- expect{ AEMO::NMI.new("NM100") }.to raise_error(ArgumentError)
73
+ context 'valid' do
74
+ it 'should return a valid NMI' do
75
+ expect(AEMO::NMI.new('NM10000000')).to be_a(AEMO::NMI)
76
+ end
77
+ it 'should return a valid NMI with MSATS' do
78
+ expect(AEMO::NMI.new('NM10000000', { msats_detail: {} })).to be_a(AEMO::NMI)
79
+ end
75
80
  end
76
- it "should raise an ArgumentError error" do
77
- expect{ AEMO::NMI.new() }.to raise_error(ArgumentError)
81
+ context 'invalid' do
82
+ it 'should raise an ArgumentError error' do
83
+ expect { AEMO::NMI.new('OOOOOOOOOO') }.to raise_error(ArgumentError)
84
+ end
85
+ it 'should raise an ArgumentError error' do
86
+ expect { AEMO::NMI.new('NM100') }.to raise_error(ArgumentError)
87
+ end
88
+ it 'should raise an ArgumentError error' do
89
+ expect { AEMO::NMI.new }.to raise_error(ArgumentError)
90
+ end
78
91
  end
79
92
  end
80
93
  describe '#valid_nmi?' do
81
94
  it 'should validate nmi' do
82
95
  json.each do |nmi|
83
- _nmi = AEMO::NMI.new(nmi['nmi'])
84
- expect(_nmi.valid_nmi?).to eq(true)
96
+ a_nmi = AEMO::NMI.new(nmi['nmi'])
97
+ expect(a_nmi.valid_nmi?).to eq(true)
85
98
  end
86
99
  end
87
100
  end
@@ -89,8 +102,8 @@ describe AEMO::NMI do
89
102
  describe '#checksum' do
90
103
  it 'should return NMI\'s checksum' do
91
104
  json.each do |nmi|
92
- _nmi = AEMO::NMI.new(nmi['nmi'])
93
- expect(_nmi.checksum).to eq(nmi['checksum'])
105
+ a_nmi = AEMO::NMI.new(nmi['nmi'])
106
+ expect(a_nmi.checksum).to eq(nmi['checksum'])
94
107
  end
95
108
  end
96
109
  end
@@ -98,14 +111,14 @@ describe AEMO::NMI do
98
111
  describe '#valid_checksum?(checksum)' do
99
112
  it 'should validate valid checksums' do
100
113
  json.each do |nmi|
101
- _nmi = AEMO::NMI.new(nmi['nmi'])
102
- expect(_nmi.valid_checksum?(nmi['checksum'])).to eq(true)
114
+ a_nmi = AEMO::NMI.new(nmi['nmi'])
115
+ expect(a_nmi.valid_checksum?(nmi['checksum'])).to eq(true)
103
116
  end
104
117
  end
105
118
  it 'should not validate invalid checksums' do
106
119
  json.each do |nmi|
107
- _nmi = AEMO::NMI.new(nmi['nmi'])
108
- expect(_nmi.valid_checksum?((1+nmi['checksum'])%10)).to eq(false)
120
+ a_nmi = AEMO::NMI.new(nmi['nmi'])
121
+ expect(a_nmi.valid_checksum?((1 + nmi['checksum']) % 10)).to eq(false)
109
122
  end
110
123
  end
111
124
  end
@@ -114,47 +127,43 @@ describe AEMO::NMI do
114
127
  # Positive test cases
115
128
  it 'should return a network for a valid NMI' do
116
129
  json.each do |nmi|
117
- _nmi = AEMO::NMI.new(nmi['nmi'])
118
- unless _nmi.network.nil?
119
- expect(_nmi.network.class).to eq(Hash)
120
- end
130
+ a_nmi = AEMO::NMI.new(nmi['nmi'])
131
+ expect(a_nmi.network.class).to eq(Hash) unless a_nmi.network.nil?
121
132
  end
122
133
  end
123
134
  # Negative test cases
124
135
  it 'should not return a network for a NMI not allocated to a network' do
125
136
  json.each do |nmi|
126
- _nmi = AEMO::NMI.new(nmi['nmi'])
127
- if _nmi.network.nil?
128
- expect(_nmi.network.class).to eq(NilClass)
129
- end
137
+ a_nmi = AEMO::NMI.new(nmi['nmi'])
138
+ expect(a_nmi.network.class).to eq(NilClass) if a_nmi.network.nil?
130
139
  end
131
140
  end
132
141
  end
133
142
 
134
- describe "#friendly_address" do
143
+ describe '#friendly_address' do
135
144
  it 'should return the empty string if the address is not a hash' do
136
- nmi = AEMO::NMI.new("4001234567")
137
- nmi.address = "An address"
145
+ nmi = AEMO::NMI.new('4001234567')
146
+ nmi.address = 'An address'
138
147
  expect(nmi.friendly_address).to eq('')
139
148
  end
140
149
  it 'should return a friendly address if the address is a hash' do
141
- nmi = AEMO::NMI.new("4001234567")
142
- nmi.address = { number: '1', street: 'Bob', street_type: 'Street'}
150
+ nmi = AEMO::NMI.new('4001234567')
151
+ nmi.address = { number: '1', street: 'Bob', street_type: 'Street' }
143
152
  expect(nmi.friendly_address).to eq('1, Bob, Street')
144
153
  end
145
154
  end
146
155
 
147
- describe "#current_daily_load" do
148
- it "should return zero for no data" do
149
- @nmi = AEMO::NMI.new("4001234567")
156
+ describe '#current_daily_load' do
157
+ it 'should return zero for no data' do
158
+ @nmi = AEMO::NMI.new('4001234567')
150
159
  expect(@nmi.current_daily_load).to eq(0)
151
160
  end
152
161
  end
153
162
 
154
- describe "#meters_by_status" do
163
+ describe '#meters_by_status' do
155
164
  before(:each) do
156
- @nmi = AEMO::NMI.new("4001234567")
157
- @nmi.meters = [OpenStruct.new(status: 'C'),OpenStruct.new(status: 'R')]
165
+ @nmi = AEMO::NMI.new('4001234567')
166
+ @nmi.meters = [OpenStruct.new(status: 'C'), OpenStruct.new(status: 'R')]
158
167
  end
159
168
  it 'should return current meters' do
160
169
  expect(@nmi.meters_by_status.count).to eq(1)
@@ -167,46 +176,45 @@ describe AEMO::NMI do
167
176
  end
168
177
  end
169
178
 
170
- describe "distribution loss factors" do
179
+ describe 'distribution loss factors' do
171
180
  before(:each) do
172
- @nmi = AEMO::NMI.new("4001234567")
173
- @nmi.dlf = "BL0A"
174
- @nmi.tni = "NGN2"
181
+ @nmi = AEMO::NMI.new('4001234567')
182
+ @nmi.dlf = 'BL0A'
183
+ @nmi.tni = 'NGN2'
175
184
  end
176
- it "has a valid DLF Code" do
177
- expect(@nmi.dlf).to eq("BL0A")
185
+ it 'has a valid DLF Code' do
186
+ expect(@nmi.dlf).to eq('BL0A')
178
187
  end
179
- it "has a DLF value" do
188
+ it 'has a DLF value' do
180
189
  expect(@nmi.dlfc_value.class).to eq(Float)
181
190
  end
182
191
  end
183
192
 
184
- describe "transmission node identifiers and loss factors" do
193
+ describe 'transmission node identifiers and loss factors' do
185
194
  before(:each) do
186
- @nmi = AEMO::NMI.new("4001234567")
187
- @nmi.dlf = "BL0A"
188
- @nmi.tni = "NGN2"
195
+ @nmi = AEMO::NMI.new('4001234567')
196
+ @nmi.dlf = 'BL0A'
197
+ @nmi.tni = 'NGN2'
189
198
  end
190
- it "has a valid TNI Code" do
191
- expect(@nmi.tni).to eq("NGN2")
199
+ it 'has a valid TNI Code' do
200
+ expect(@nmi.tni).to eq('NGN2')
192
201
  end
193
- it "has a TNI value" do
202
+ it 'has a TNI value' do
194
203
  expect(@nmi.tni_value.class).to eq(Float)
195
204
  end
196
205
  end
197
206
 
198
- describe "MSATS functions" do
207
+ describe 'MSATS functions' do
199
208
  it 'should get data' do
200
- AEMO::MSATS.authorize("ER","ER","ER")
209
+ AEMO::MSATS.authorize('ER', 'ER', 'ER')
201
210
  nmi = AEMO::NMI.new('4001234567')
202
211
  nmi.update_from_msats!
203
212
  expect(nmi.msats_detail).to_not eq(nil)
204
213
  end
205
214
  it 'should return the hash of raw data' do
206
- AEMO::MSATS.authorize("ER","ER","ER")
215
+ AEMO::MSATS.authorize('ER', 'ER', 'ER')
207
216
  nmi = AEMO::NMI.new('4001234567')
208
217
  expect(nmi.raw_msats_nmi_detail.class).to eq(Hash)
209
218
  end
210
219
  end
211
-
212
220
  end