Sha256: 080b1242910ff22dc8a41853c0192d373656288ff8366ef75d8c3ab9ca62739d

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

require 'test_helper'

class CreateReportTest < ActionDispatch::IntegrationTest
  should "successfully create a report" do
    records = [
      OpenStruct.new(:one => 'one', :two => 'two'),
      OpenStruct.new(:one => 'a', :two => 'b')
    ]
    flexmock(records).should_receive(:where).and_return(records)
    flexmock(records).should_receive(:order).once.and_return(records)

    report = BasicReport.create
    flexmock(report).should_receive(:records).once.and_return(records)

    report.generate_csv!
    assert report.reload.csv.present?
    file = File.open report.csv.path
    assert_equal "col1,col2\none,two\na,b\n", file.read
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mint_reporter-0.0.7 test/integration/create_report_test.rb