spec/tools_spec.rb in rspreadsheet-0.4.9 vs spec/tools_spec.rb in rspreadsheet-0.5.0
- old
+ new
@@ -11,10 +11,12 @@
@tools.convert_cell_address_to_coordinates('Am1048576').should == [1048576,39]
@tools.convert_cell_address_to_coordinates('aDa2').should == [2,781]
@tools.convert_cell_address_to_coordinates('Zz1').should == [1,702]
@tools.a2c('AdA2').should == [2,781]
@tools.a2c('ADA','2').should == [2,781]
+ @tools.a2c('G','11').should == [11,7]
+ @tools.a2c(11, 'G').should == [11,7]
end
it 'converts correctly cell coordinates to adresses' do
@tools.convert_cell_coordinates_to_address([1,1]).should == 'A1'
@tools.convert_cell_coordinates_to_address([17,3]).should == 'C17'
@tools.convert_cell_coordinates_to_address([1,27]).should == 'AA1'
@@ -32,10 +34,13 @@
end
it 'raises exception when given rubbisch' do
expect{ @tools.a2c('A1A') }.to raise_error
expect{ @tools.a2c('1A11') }.to raise_error
expect{ @tools.a2c('1A11') }.to raise_error
+ expect{ @tools.a2c('F','G') }.to raise_error
+ expect{ @tools.a2c(5,'G1') }.to raise_error
+ expect{ @tools.a2c('G1',5) }.to raise_error
end
it 'converts correctly cell adresses given by components to coordinates' do
@tools.a2c('A','1').should eq [1,1]
@tools.a2c('C','17').should eq [17,3]
@tools.a2c('17','C',).should eq [17,3]
@@ -43,7 +48,15 @@
end
it 'given two numbers converts them correctly even when "hidden" in strings' do
@tools.a2c('3','17').should eq [3,17]
@tools.a2c(21,'11.0').should eq [21,11]
@tools.a2c('23',22/2).should eq [23,11]
+ end
+ it 'can remove attributes from nodes' do
+ node = LibXML::XML::Node.new('a')
+ @tools.set_ns_attribute(node,'table','ref','123')
+ @tools.get_ns_attribute_value(node,'table','ref').should == '123'
+ @tools.remove_ns_attribute(node,'table','ref')
+ @tools.get_ns_attribute_value(node,'table','ref').should == nil
+ @tools.get_ns_attribute_value(node,'table','ref','nic').should == 'nic'
end
end