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

Version Path
brcobranca-9.2.4 spec/support/shared_examples/formatos_validos.rb
brcobranca-9.2.3 spec/support/shared_examples/formatos_validos.rb
bbrcobranca-0.0.2 spec/support/shared_examples/formatos_validos.rb
bbrcobranca-0.0.1 spec/support/shared_examples/formatos_validos.rb
brcobranca-9.2.2 spec/support/shared_examples/formatos_validos.rb
brcobranca-9.2.1 spec/support/shared_examples/formatos_validos.rb
brcobranca-9.2.0 spec/support/shared_examples/formatos_validos.rb
brcobranca-9.1.2 spec/support/shared_examples/formatos_validos.rb
brcobranca-9.1.1 spec/support/shared_examples/formatos_validos.rb
brcobranca-9.1.0 spec/support/shared_examples/formatos_validos.rb
brcobranca-9.0.0 spec/support/shared_examples/formatos_validos.rb