Sha256: 73498b470ceb9d9b3f8651dd0d3c0be467fe0c437aff8c5a0e48990702d568eb

Contents?: true

Size: 587 Bytes

Versions: 3

Compression:

Stored size: 587 Bytes

Contents

# -*- coding: utf-8 -*-
require 'test_helper'

class CsvRails::MongoidTest < ActiveSupport::TestCase
  setup do
    Post.create(:title => 'title', :body => "foobar") if Post.where(:title => 'title').length < 1
  end

  teardown do
    I18n.locale = :en
  end

  test ".to_csv" do
    assert_equal "Title,Body\ntitle,foobar\n", Post.where(:title => 'title').to_csv(:fields => [:title, :body])
  end

  test ".to_csv with ja locale" do
    I18n.locale = :ja
    assert_equal "タイトル,本文\ntitle,foobar\n", Post.where(:title => 'title').to_csv(:fields => [:title, :body])
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
csv_rails-0.7.0 test/csv_rails/mongoid_test.rb
csv_rails-0.6.1 test/csv_rails/mongoid_test.rb
csv_rails-0.6.0 test/csv_rails/mongoid_test.rb