spec/importer/column_spec.rb in iron-import-0.7.0 vs spec/importer/column_spec.rb in iron-import-0.8.0
- old
+ new
@@ -110,6 +110,31 @@
@importer.has_errors?.should be_false
@col.validate_value(@row, 4).should be_false
@importer.has_errors?.should be_true
end
+ it 'should record optionalness' do
+ @col.optional?.should be_false
+ @col.optional!
+ @col.optional?.should be_true
+ end
+
+ it 'should know if it is present in the headers' do
+ @col.present?.should be_false
+ @col.data.index = 2
+ @col.present?.should be_true
+ end
+
+ it 'should use the header text as its name if present' do
+ @col.data.index = 2
+ @col.to_s.should == 'Column C'
+ @col.data.header_text = 'Invoice #'
+ @col.to_s.should == 'Invoice # Column'
+ end
+
+ it 'should support virtual operation' do
+ @col.virtual!
+ @col.virtual?.should be_true
+ @col.to_s.should == 'Test Column'
+ end
+
end
\ No newline at end of file