rbook-bisac 0.6 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/testtask'
6
6
  require "rake/gempackagetask"
7
7
  require 'spec/rake/spectask'
8
8
 
9
- PKG_VERSION = "0.6"
9
+ PKG_VERSION = "0.6.1"
10
10
  PKG_NAME = "rbook-bisac"
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
  RUBYFORGE_PROJECT = 'rbook'
@@ -16,6 +16,7 @@ module RBook
16
16
  # refer to the bisac spec for the expected format of the string
17
17
  def self.load_from_string(data)
18
18
  raise RBook::InvalidArgumentError, 'data must be a string' unless data.kind_of? String
19
+ data.strip!
19
20
 
20
21
  item = self.new
21
22
 
@@ -7,11 +7,12 @@ context "A new bisac purchase order line item object" do
7
7
 
8
8
  setup do
9
9
  @valid_row = "4000003 14976 Y000000000102978513220000100000000000000000000550000000"
10
+ @valid_row_two = "4000033 13424 Y000000001107538214940000200000000000000000000400000000 \n"
10
11
  @valid_isbn13_row = "4000003 14627 Y000000000103855198500000600000000000000000000400000000 9780385519854"
11
12
  @invalid_row_nil = nil
12
13
  @invalid_row_num = 23
13
14
  end
14
-
15
+
15
16
  specify "Should load a line from a bisac po file correctly" do
16
17
  item = RBook::Bisac::POLineItem.load_from_string(@valid_row)
17
18
  item.should be_a_kind_of(RBook::Bisac::POLineItem)
@@ -25,6 +26,19 @@ context "A new bisac purchase order line item object" do
25
26
  item.price.should eql(0)
26
27
  end
27
28
 
29
+ specify "Should load a line from a bisac po file correctly, even if they they have whitepsace padding" do
30
+ item = RBook::Bisac::POLineItem.load_from_string(@valid_row_two)
31
+ item.should be_a_kind_of(RBook::Bisac::POLineItem)
32
+
33
+ item.sequence_number.should eql(33)
34
+ item.po_number.should eql("13424")
35
+ item.line_item_number.should eql("0000000011")
36
+ item.isbn.should eql("0753821494")
37
+ item.qty.should eql(2)
38
+ item.catalogue_code.should eql("0")
39
+ item.price.should eql(0)
40
+ end
41
+
28
42
  specify "Should prefer the ISBN13 over ISBN10 when available" do
29
43
  item = RBook::Bisac::POLineItem.load_from_string(@valid_isbn13_row)
30
44
  item.should be_a_kind_of(RBook::Bisac::POLineItem)
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: rbook-bisac
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.6"
6
+ version: 0.6.1
7
7
  date: 2007-12-10 00:00:00 +11:00
8
8
  summary: A library for manipulating BISAC files
9
9
  require_paths: