Sha256: 54a1a912b0f6edb22ddf2967b62f7e232ee2aa052027130e7b5c13bd5e1859a4
Contents?: true
Size: 1.36 KB
Versions: 5
Compression:
Stored size: 1.36 KB
Contents
# coding: utf-8 require "spec_helper" describe Dech::Rakuten::CSV do describe "initialize" do products = [ {id: "ABC-001", price: 12800}, {id: "xyz-123", price: 9800} ] subject{ Dech::Rakuten::CSV.new(products) } it { is_expected.to be_an_instance_of(Dech::Rakuten::CSV) } it { is_expected.to be_a(Dech::CSV) } it { is_expected.to be_a(StringIO) } end describe "#valid?" do context "with valid columns" do products = [ {id: "ABC-001", price: 12800}, {id: "xyz-123", price: 9800} ] subject{ Dech::Rakuten::CSV.new(products) } it { is_expected.to be_valid } end context "with invalid columns" do products = [ {price: 12800}, {price: 9800} ] subject{ Dech::Rakuten::CSV.new(products) } it { is_expected.not_to be_valid } end end describe "#validate!" do context "valid columns" do products = [ {id: "ABC-001", price: 12800}, {id: "xyz-123", price: 9800} ] subject{ lambda{ Dech::Rakuten::CSV.new(products).validate! } } it { is_expected.not_to raise_error } end context "invalid columns" do products = [ {price: 12800}, {price: 9800} ] subject{ lambda{ Dech::Rakuten::CSV.new(products).validate! } } it { is_expected.to raise_error } end end end
Version data entries
5 entries across 5 versions & 1 rubygems