Skip to content

Commit

Permalink
Add basic spec for decimal_separator option during resultset loading.
Browse files Browse the repository at this point in the history
Change spec.opts to default output format (simple, no extended reporing).
  • Loading branch information
ginjo committed Dec 15, 2017
1 parent 34a3bc8 commit 336a358
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require 'rspec/core/rake_task'
# end

RSpec::Core::RakeTask.new(:spec) do |task|
# Optionally pass env var SPEC_OPTS='--whatever' to pass opts to rspec thru rake.
task.rspec_opts = '-O spec/spec.opts'
end

Expand Down
12 changes: 12 additions & 0 deletions spec/rfm/resultset_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
expect(result.portal_meta["projectlineitemssubitems_pli"]["finishheight"].result).to eq("number")
expect(result.portal_meta["projectlineitemssubitems_pli"]["border"].result).to eq("text")
end

# TODO: This spec should probably be in a field_spec.rb file.
it "loads fmresultset.xml accounting for decimal separator in confg" do
resultset_class = Class.new(Rfm::Resultset){ include Rfm::Config }
resultset = resultset_class.new(:decimal_separator => ',')
handler = resultset_class.load_data "spec/data/resultset_with_decimals.xml", resultset
result = handler.result
expect(result[0][:total_value]).to eq(25500.4)
expect(result[0][:half_value]).to eq(12750.2)
expect(result[2][:total_value]).to eq(11.2345)
expect(result[2][:half_value]).to eq(5.61725)
end
end

# TODO: write specs for data loading & portal loading.
Expand Down
4 changes: 3 additions & 1 deletion spec/spec.opts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Optionally pass env var SPEC_OPTS='--whatever' to pass opts to rspec thru rake.

--colour
--format doc
#--format doc
--backtrace
#--timeout 20
#--diff unified
Expand Down

0 comments on commit 336a358

Please sign in to comment.