Sha256: 59cc9ca673e10906432d97056e6d2d2523ea62294172bbc6007d54748020374f

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 Bytes

Contents

require_relative 'spec_helper'

describe ArrayFormulaCell do
  
#  <c r="B3"><f t="array" ref="B3:E6">B2:E2+A3:A6</f><v>2</v></c>

it "it is given a value cell and a pre-parsed formula and picks out values from its array references according to array_formula_offset" do
  value_cell = ValueCell.new(mock('worksheet',:to_s => 'sheet1'),Nokogiri::XML('<c r="D6"><v>7</v></c>').root)
  
  cell = ArrayFormulaCell.from_other_cell(value_cell)
  cell.array_formula_reference = "b3_array"
  cell.array_formula_offset = [1,1]
  cell.to_ruby.should == "def d6; @d6 ||= b3_array.array_formula_offset(1,1); end\n"
  cell.to_test.should == "it 'cell d6 should equal 7.0' do\n  sheet1.d6.should be_close(7.0,0.7)\nend\n\n"
end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyfromexcel-0.0.4 spec/array_formula_cell_spec.rb