Sha256: 8a38779bbf5d3a8906ab02d228982b7e570035887dac53323fdb9a94b1625a6a
Contents?: true
Size: 1.19 KB
Versions: 5
Compression:
Stored size: 1.19 KB
Contents
# -*- encoding: utf-8 -*- shared_examples_for 'formatos_validos' do it 'válido com método to_' do @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') 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
5 entries across 5 versions & 1 rubygems