Sha256: 6ed1c8c8fad9b46d29e004578dd900a41e5e8f782539be1a49d56d36938a1bd1
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
require 'spec_helper' # comma do # name 'Title' # description # # isbn :number_10 => 'ISBN-10', :number_13 => 'ISBN-13' # end describe Comma::HeaderExtractor do # rubocop:disable Metrics/BlockLength before do @isbn = Isbn.new('123123123', '321321321') @book = Book.new('Smalltalk-80', 'Language and Implementation', @isbn) @headers = @book.to_comma_headers end describe 'when no parameters are provided' do it 'should use the method name as the header name, humanized' do @headers.should include('Description') end end describe 'when given a string description as a parameter' do it 'should use the string value, unmodified' do @headers.should include('Title') end end describe 'when an hash is passed as a parameter' do describe 'with a string value' do it 'should use the string value, unmodified' do @headers.should include('ISBN-10') end end describe 'with a non-string value' do it 'should use the non string value converted to a string, humanized' do @headers.should include('Issuer') end end end end describe Comma::HeaderExtractor, 'with static column method' do before do @headers = Class.new(Struct.new(:id, :name)) do comma do __static_column__ __static_column__ 'STATIC' __static_column__ 'STATIC' do '' end end end.new(1, 'John Doe').to_comma_headers end it 'should extract headers' do @headers.should eq(['', 'STATIC', 'STATIC']) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comma-4.2.0 | spec/comma/header_extractor_spec.rb |