spec/openstudio/excel_spec.rb in openstudio-analysis-0.3.6 vs spec/openstudio/excel_spec.rb in openstudio-analysis-0.3.7
- old
+ new
@@ -34,11 +34,10 @@
#
end
it 'should not export to a JSON' do
@excel.process
-
end
end
context 'small list of incomplete variables' do
before(:all) do
@@ -472,11 +471,11 @@
expect(j['analysis']['problem']['workflow'][1]['arguments'][0]['display_name']).to eq 'unknown'
expect(j['analysis']['problem']['workflow'][1]['arguments'][0]['display_name_short']).to eq 'un'
end
end
- context 'version 0.3.3 and short display names' do
+ context 'version 0.3.5 and measure paths' do
before :all do
@excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_5_multiple_measure_paths.xlsx')
end
it 'should process' do
@@ -488,9 +487,62 @@
model_uuid = @excel.models.first[:name]
expect(File.exist?("spec/files/export/analysis/#{model_uuid}.json")).to eq true
expect(File.exist?("spec/files/export/analysis/#{model_uuid}.zip")).to eq true
- expect(@excel.aws_tags).to eq(['org=5500','nothing=else matters'])
+ expect(@excel.settings['openstudio_server_version']).to eq('1.8.0')
+ expect(@excel.settings['spreadsheet_version']).to eq '0.3.5'
+ expect(@excel.settings['server_instance_type']).to eq 'm3.xlarge'
+ expect(@excel.settings['worker_instance_type']).to eq 'c3.2xlarge'
+
+ expect(@excel.aws_tags).to eq(['org=5500', 'nothing=else matters'])
end
end
+
+ context 'version 0.3.7 and worker init-final scripts' do
+ before :all do
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_7_worker_init_final.xlsx')
+ end
+
+ it 'should process' do
+ expect(@excel.process).to eq(true)
+ end
+
+ it 'should save the analysis' do
+ @excel.save_analysis
+ model_uuid = @excel.models.first[:name]
+
+ expect(File.exist?("spec/files/export/analysis/#{model_uuid}.json")).to eq true
+ expect(File.exist?("spec/files/export/analysis/#{model_uuid}.zip")).to eq true
+
+ expect(@excel.worker_inits.size).to eq 2
+ expect(@excel.worker_inits[0][:name]).to eq 'initialize me'
+ expect(@excel.worker_inits[0][:args]).to eq "[\"first_arg\",2,{a_hash: \"input\"}]"
+
+ # test the evaling of the args
+ a = eval(@excel.worker_inits[0][:args])
+ expect(a[0]).to eq 'first_arg'
+ expect(a[1]).to eq 2
+ expect(a[2]).to be_a Hash
+ expect(a[2][:a_hash]).to eq 'input'
+
+ expect(@excel.worker_inits[0][:ordered_file_name]).to eq '00_first_file.rb'
+ expect(@excel.worker_inits[1][:ordered_file_name]).to eq '01_second_file.rb'
+
+ expect(@excel.worker_finals.size).to eq 1
+ expect(@excel.worker_inits[0][:ordered_file_name]).to eq '00_first_file.rb'
+
+ end
+ end
+
+ context 'version 0.3.7 and worker init-final scripts' do
+ before :all do
+ @excel = OpenStudio::Analysis::Translator::Excel.new('spec/files/0_3_7_unique_measure_names.xlsx')
+ end
+
+ it 'should fail to process' do
+ expect { @excel.process }.to raise_error("Measure Display Names are not unique for 'Rotate Building Relative to Current Orientation', 'Nothing Important'")
+ end
+
+ end
+
end