Sha256: a5378e181c679ae04ce926d8598f6772217d549f25a3893874f5113faf4d01c3
Contents?: true
Size: 1.32 KB
Versions: 11
Compression:
Stored size: 1.32 KB
Contents
# -*- encoding: utf-8 -*- shared_examples_for 'formatos_validos' do it 'válido com método to_' do @valid_attributes[:data_vencimento] = Date.parse('2009/08/14') @valid_attributes[:data_documento] = Date.parse('2009/08/13') boleto_novo = described_class.new(@valid_attributes) %w(pdf jpg tif png).each do |format| file_body = boleto_novo.send("to_#{format}".to_sym) tmp_file = Tempfile.new('foobar.' << format) tmp_file.puts file_body tmp_file.close expect(File.exist?(tmp_file.path)).to be_truthy expect(File.stat(tmp_file.path).zero?).to be_falsey expect(File.delete(tmp_file.path)).to eql(1) expect(File.exist?(tmp_file.path)).to be_falsey end end it 'válido' do @valid_attributes[:data_documento] = Date.parse('2009/08/13') @valid_attributes[:data_vencimento] = Date.parse('2009/08/13') boleto_novo = described_class.new(@valid_attributes) %w(pdf jpg tif png).each do |format| file_body = boleto_novo.to(format) tmp_file = Tempfile.new('foobar.' << format) tmp_file.puts file_body tmp_file.close expect(File.exist?(tmp_file.path)).to be_truthy expect(File.stat(tmp_file.path).zero?).to be_falsey expect(File.delete(tmp_file.path)).to eql(1) expect(File.exist?(tmp_file.path)).to be_falsey end end end
Version data entries
11 entries across 11 versions & 2 rubygems