spec/io/io_spec.rb in daru-0.2.0 vs spec/io/io_spec.rb in daru-0.2.1
- old
+ new
@@ -49,9 +49,19 @@
it "uses the custom boolean converter correctly" do
df = Daru::DataFrame.from_csv 'spec/fixtures/boolean_converter_test.csv', converters: [:boolean]
expect(df['Domestic'].to_a).to all be_boolean
end
+ it "uses the custom string converter correctly" do
+ df = Daru::DataFrame.from_csv 'spec/fixtures/string_converter_test.csv', converters: [:string]
+ expect(df['Case Number'].to_a.all? {|x| String === x }).to be_truthy
+ end
+
+ it "allow symbol to converters option" do
+ df = Daru::DataFrame.from_csv 'spec/fixtures/boolean_converter_test.csv', converters: :boolean
+ expect(df['Domestic'].to_a).to all be_boolean
+ end
+
it "checks for equal parsing of local CSV files and remote CSV files" do
%w[matrix_test repeated_fields scientific_notation sales-funnel].each do |file|
df_local = Daru::DataFrame.from_csv("spec/fixtures/#{file}.csv")
df_remote = Daru::DataFrame.from_csv("http://dummy-remote-url/#{file}.csv")
expect(df_local).to eq(df_remote)