spec/extensions/csv_serializer_spec.rb in sequel-4.30.0 vs spec/extensions/csv_serializer_spec.rb in sequel-4.31.0
- old
+ new
@@ -1,7 +1,13 @@
require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
+begin
+ csv_lib = RUBY_VERSION < '1.9' ? 'fastercsv' : 'csv'
+ require csv_lib
+rescue LoadError => e
+ skip_warn "csv_serializer plugin: can't load #{csv_lib} (#{e.class}: #{e})"
+else
describe "Sequel::Plugins::CsvSerializer" do
before do
artist = @Artist = Class.new(Sequel::Model(:artists))
@Artist.class_eval do
def self.name; 'Artist' end
@@ -168,6 +174,7 @@
it "should pass all the examples from the documentation" do
@album.to_csv(:write_headers=>true).must_equal "id,name,artist_id\n1,RF,2\n"
@album.to_csv(:only=>:name).must_equal "RF\n"
@album.to_csv(:except=>[:id, :artist_id]).must_equal "RF\n"
end
+end
end