Sha256: 46e6afb6b6c1d784ddbf499fe31057c52705e345967f6044cef77cf35f9f71f1

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 Bytes

Contents

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

class UsersControllerTest < ActionController::TestCase
  setup do
    User.create(:name => 'yalab', :age => '4', :secret => 'secret')
    I18n.locale = :ja
    @fields = [:id, :name, :age, :"groups.first.name"]
  end

  test "should get index" do
    get :index, :format => 'csv'
    assert_equal User.all.to_csv(fields: @fields, without_header: true), response.body
  end

  test "should get sjis" do
    get :sjis, :format => 'csv'
    assert_equal User.all.to_csv(fields: @fields).encode('SJIS'), response.body
  end

  teardown do
    I18n.locale = :en
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
csv_rails-0.6.0 test/dummy/test/functional/users_controller_test.rb
csv_rails-0.5.2 test/dummy/test/functional/users_controller_test.rb
csv_rails-0.5.1 test/dummy/test/functional/users_controller_test.rb
csv_rails-0.5.0 test/dummy/test/functional/users_controller_test.rb