Sha256: 79e4a4f3c8cbc2422fe51c4fe6fb75781c4a9becccf0c4c975ecbb831439c87f

Contents?: true

Size: 1.19 KB

Versions: 7

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 be(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 be(1)
      expect(File.exist?(tmp_file.path)).to be_falsey
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
brcobranca-8.0.0 spec/support/shared_examples/formatos_validos.rb
brcobranca-7.3.0 spec/support/shared_examples/formatos_validos.rb
brcobranca-7.2.2 spec/support/shared_examples/formatos_validos.rb
brcobranca-7.2.1 spec/support/shared_examples/formatos_validos.rb
brcobranca-7.2.0 spec/support/shared_examples/formatos_validos.rb
brcobranca-7.1.0 spec/support/shared_examples/formatos_validos.rb
brcobranca-7.0.0 spec/support/shared_examples/formatos_validos.rb