Sha256: 2c42a93e4d80f282790e4d31a2390401c3a12765e86d4e5a1618a6dcc06d6d03
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
# coding: utf-8 require 'spec_helper' describe ONIX2::Series do Given(:doc) { load_xml "series.xml" } describe "should correctly convert to a string" do Given(:series) { ONIX2::Series.from_xml(doc) } Then{ series.to_xml.to_s.start_with? "<Series>" } end describe "should provide read access to first level attributes" do Given(:series) { ONIX2::Series.from_xml(doc) } Then{ series.title_of_series == "Citizens and Their Governments" } end context "should provide write access to first level attributes" do Given(:series) { ONIX2::Series.new } describe :title_of_series= do When { series.title_of_series = "Cool Science Careers" } Then { series.to_xml.to_s.include? "<TitleOfSeries>Cool Science Careers</TitleOfSeries>" } end end describe "should provide read access to series IDs" do Given(:series) { ONIX2::Series.from_xml(doc) } Then { series.series_identifiers.size == 2 } end context "should provide write access to series IDs" do Given(:series_identifier1) { ONIX2::SeriesIdentifier.new(series_id_type: 1, id_value: 10001) } Given(:series_identifier2) { ONIX2::SeriesIdentifier.new(series_id_type: 2, id_value: 20002) } Given(:series) { ONIX2::Series.new } describe :series_identifiers= do When { series.series_identifiers = [series_identifier1, series_identifier2] } Then { series.to_xml.to_s.include? "<SeriesIDType>01</SeriesIDType>" } Then { series.to_xml.to_s.include? "<IDValue>20002</IDValue>" } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
onix2-1.0.0 | spec/series_spec.rb |