test/dummy/test/unit/user_test.rb in csv_rails-0.4.0 vs test/dummy/test/unit/user_test.rb in csv_rails-0.4.1

- old
+ new

@@ -18,15 +18,10 @@ test "#to_csv_ary use method not a database field" do assert_equal [@user.one], @user.to_csv_ary([:one]) end - test "#to_csv_ary accept encoding" do - name = 'よしだ' - assert_equal name.encode('SJIS'), User.create(:name => name).to_csv_ary([:name], :encoding => 'SJIS').first - end - test "#updated_at_as_csv" do assert_equal @user.updated_at.strftime("%F %H:%M"), @user.updated_at_as_csv end test ".to_csv without params" do @@ -66,6 +61,11 @@ I18n.locale = :ja assert_equal "名前".encode('SJIS'), CSV.parse(User.to_csv(:fields => [:name], :encoding => 'SJIS')).first.first I18n.locale = :en end + test "Array.to_csv accept encoding" do + I18n.locale = :ja + assert_equal "名前".encode('SJIS'), CSV.parse(User.all.to_csv(:fields => [:name], :encoding => 'SJIS')).first.first + I18n.locale = :en + end end