-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add validation for new Fever attributes
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe Atlas::NodeAttributes::Fever do | ||
describe '#curve for consumer nodes' do | ||
context 'when the curve is not a hash' do | ||
it 'has an error' do | ||
mo = described_class.new(type: :consumer, curve: :households_heating) | ||
expect(mo.errors_on(:curve)).to include('must consist of a definition for each technology curve type, e.g. curve.tech_day_night') | ||
end | ||
end | ||
|
||
context 'when one curve key is not valid' do | ||
it 'has an error' do | ||
mo = described_class.new(type: :consumer, curve: {tech_nope: :households_heating }) | ||
expect(mo.errors_on(:curve)).to include('keys must be one of [:tech_day_night, :tech_constant]') | ||
end | ||
end | ||
|
||
context 'when no curve is specified' do | ||
it 'has an error' do | ||
mo = described_class.new(type: :consumer) | ||
expect(mo.errors_on(:curve)).to include('must be set for consumers') | ||
end | ||
end | ||
end | ||
end |