Sha256: 950c5c19beea9bd67802aaa0673bdcaacb0e095e73420e36a4e2818ae321874e

Contents?: true

Size: 757 Bytes

Versions: 15

Compression:

Stored size: 757 Bytes

Contents

require_relative 'spec_helper'

describe SharedFormulaBuilder, "Formulas with shared_formula_offsets" do
  
  before(:each) do
    @builder = SharedFormulaBuilder.new
    @builder.shared_formula_offset = [1,1]
  end
  
  def ruby_for(formula)
    ast = Formula.parse(formula)
    ast.visit(@builder)
  end
  
  it "should move individual references appropriately" do
    ruby_for("A1").should == "b2"
    ruby_for("A$1").should == "b1"
    ruby_for("$A1").should == "a2"
    ruby_for("$A$1").should == "a1"
  end
  
  it "should move several references in the same formula" do
    ruby_for("A1+B2").should == "b2+c3"
    ruby_for("A$1+B$1").should == "b1+c1"
    ruby_for("$A1+$B1").should == "a2+b2"
    ruby_for("$A$1+$B$1").should == "a1+b1"
  end
  
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rubyfromexcel-0.0.23 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.22 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.21 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.20 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.19 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.18 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.17 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.16 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.13 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.10 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.9 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.7 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.6 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.5 spec/shared_formula_builder_spec.rb
rubyfromexcel-0.0.4 spec/shared_formula_builder_spec.rb