elibri_onix_mocks 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/elibri_onix_mocks.gemspec +2 -1
- data/lib/elibri_onix_mocks/mocks/mock_method_missing.rb +5 -4
- data/lib/elibri_onix_mocks/mocks/xml_mocks.rb +29 -2
- data/lib/elibri_onix_mocks/version.rb +1 -1
- data/lib/elibri_onix_mocks.rb +1 -0
- data/spec/elibri_onix_mocks_spec.rb +219 -3
- metadata +40 -12
data/Gemfile
CHANGED
data/elibri_onix_mocks.gemspec
CHANGED
@@ -20,10 +20,11 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
# specify any dependencies here; for example:
|
22
22
|
s.add_development_dependency "rspec"
|
23
|
-
|
23
|
+
s.add_development_dependency 'ruby-debug'
|
24
24
|
s.add_development_dependency 'rake'
|
25
25
|
|
26
26
|
# s.add_runtime_dependency "rest-client"
|
27
|
+
s.add_runtime_dependency "elibri_onix"
|
27
28
|
s.add_runtime_dependency "elibri_onix_generator"
|
28
29
|
s.add_runtime_dependency "elibri_onix_dict"
|
29
30
|
s.add_runtime_dependency 'elibri_api_client'
|
@@ -7,8 +7,8 @@ module Elibri
|
|
7
7
|
def method_missing(m, *args, &block)
|
8
8
|
if m == :product_form_onix_code
|
9
9
|
super
|
10
|
-
elsif [:
|
11
|
-
nil #
|
10
|
+
elsif [:kind_of_measurable?].include? m
|
11
|
+
nil #bo jednostki są w elibri
|
12
12
|
elsif [:publisher_id, :publisher_symbol, :record_reference, :ean, :no_isbn,
|
13
13
|
:ean_other_than_isbn, :product_form_onix_code, :file_size, :publication_year,
|
14
14
|
:publication_month, :publication_day, :number_of_pages, :number_of_illustrations,
|
@@ -16,7 +16,7 @@ module Elibri
|
|
16
16
|
:series_membership_kind, :set_membership_kind, :created_at, :updated_at,
|
17
17
|
:book_cover_type_onix_code, :edition_statement, :audience_age_from,
|
18
18
|
:audience_age_to, :sale_restricted_to, :sale_restricted_for, :imprint_id,
|
19
|
-
:
|
19
|
+
:publishing_status_onix_code, :sale_restricted, :isbn_id, :price_amount ,
|
20
20
|
:price_currency, :price_printed_on_product_onix_code, :pack_quantity, :state,
|
21
21
|
:__elibri_product_category1_identifier, :__elibri_product_category2_identifier,
|
22
22
|
:template_product_id, :title, :subtitle, :or_title, :cascading_title, :collection_id,
|
@@ -27,7 +27,8 @@ module Elibri
|
|
27
27
|
:super_siodemka_export_id, :wilga_xml_checksum, :isbn_from_import, :external_id, :stock_operator, :stock_quantity,
|
28
28
|
:motyl_product_id, :exported_to_motyl, :exported_to_motyl_at, :motyl_export_id, :epub_technical_protection_onix_code,
|
29
29
|
:product_form_detail_onix_code, :epub_sale_restricted_to, :epub_sale_not_restricted, :settlement_id,
|
30
|
-
:collection, :trade_title, :imprint, :publisher_name, :sale_restricted?, :skip_ProductSupply, :cover_type, :preview_exists
|
30
|
+
:collection, :trade_title, :imprint, :publisher_name, :sale_restricted?, :skip_ProductSupply, :cover_type, :preview_exists?,
|
31
|
+
:kind_of_book?, :kind_of_audio?, :kind_of_map?, :kind_of_ebook?].include? m #nieobowiązkowe pola
|
31
32
|
begin
|
32
33
|
super
|
33
34
|
rescue Mocha::ExpectationError
|
@@ -78,6 +78,7 @@ module Elibri
|
|
78
78
|
:kind_of_ebook? => true,
|
79
79
|
:kind_of_audio? => true,
|
80
80
|
:kind_of_map? => true,
|
81
|
+
:kind_of_measurable? => true,
|
81
82
|
#:map_scale => '20000',
|
82
83
|
:elibri_product_category1_id => 1110,
|
83
84
|
:elibri_product_category2_id => 491,
|
@@ -130,8 +131,8 @@ module Elibri
|
|
130
131
|
:series_memberships => [
|
131
132
|
stub('SeriesMembership', :series_name => 'Lektury szkolne', :number_within_series => '2').extend(MockMethodMissing)
|
132
133
|
],
|
133
|
-
|
134
|
-
|
134
|
+
# :facsimiles => [stub('Product', :publisher_name => 'PWN', :publisher_id => 12, :publisher_symbol => 'Tytuł dodruku', :isbn_value => '9788324705818')],
|
135
|
+
# :similar_products => [stub('Product', :publisher_name => 'WNT', :publisher_id => 13, :publisher_symbol => 'Tytuł podobnej książki', :isbn_value => '9788324799992')],
|
135
136
|
:attachments => [
|
136
137
|
stub('ProductAttachment',
|
137
138
|
:id => 668,
|
@@ -767,6 +768,27 @@ module Elibri
|
|
767
768
|
end.extend(MockMethodMissing)
|
768
769
|
end
|
769
770
|
|
771
|
+
def collection_mock(options = {})
|
772
|
+
opt =
|
773
|
+
{
|
774
|
+
:name => 'Nazwa kolekcji'
|
775
|
+
}.merge(options)
|
776
|
+
mock('PublisherCollection').tap do |coll|
|
777
|
+
coll.stubs(
|
778
|
+
opt
|
779
|
+
)
|
780
|
+
end.extend(MockMethodMissing)
|
781
|
+
end
|
782
|
+
|
783
|
+
def authorship_kind_mock(options = {})
|
784
|
+
opt = {
|
785
|
+
:user_given? => true,
|
786
|
+
:collective? => false,
|
787
|
+
:no_contributor? => false
|
788
|
+
}.merge(options)
|
789
|
+
stub('AuthorshipKind', opt)
|
790
|
+
end
|
791
|
+
|
770
792
|
def description_mock(options = {})
|
771
793
|
opt =
|
772
794
|
{
|
@@ -786,6 +808,11 @@ module Elibri
|
|
786
808
|
end.extend(MockMethodMissing)
|
787
809
|
end
|
788
810
|
|
811
|
+
def product_with_similars_mock(options = {})
|
812
|
+
product_1 = Elibri::XmlMocks::Examples.book_example(:title => 'title_1')
|
813
|
+
product_2 = Elibri::XmlMocks::Examples.book_example(:title => 'title_2', :isbn_value => '9788324799993', :record_reference => 'fdb8fa072be774d97a98')
|
814
|
+
Elibri::XmlMocks::Examples.book_example(:record_reference => 'fdb8fa072be774d97a99', :isbn_value => '9788324799990', :facsimiles => [product_1, product_2])
|
815
|
+
end
|
789
816
|
|
790
817
|
end
|
791
818
|
end
|
data/lib/elibri_onix_mocks.rb
CHANGED
@@ -4,7 +4,9 @@ require 'spec_helper'
|
|
4
4
|
$VERBOSE = nil #temp: supress id warnings
|
5
5
|
|
6
6
|
describe Elibri::XmlMocks::Examples do
|
7
|
-
|
7
|
+
|
8
|
+
|
9
|
+
|
8
10
|
[
|
9
11
|
:basic_product, :book_example, :onix_record_identifiers_example, :onix_product_form_example,
|
10
12
|
:onix_epub_details_example, :onix_languages_example,
|
@@ -13,7 +15,8 @@ describe Elibri::XmlMocks::Examples do
|
|
13
15
|
:onix_audiobook_extent_example, :onix_no_contributors_example, :onix_collective_work_example,
|
14
16
|
:onix_contributors_example, :onix_announced_product_example, :onix_preorder_product_example,
|
15
17
|
:onix_published_product_example, :onix_out_of_print_product_example, :onix_titles_example,
|
16
|
-
:onix_title_with_collection_example, :onix_texts_example,
|
18
|
+
:onix_title_with_collection_example, :onix_texts_example,
|
19
|
+
# :onix_related_products_example, #temporarly disabled
|
17
20
|
:onix_supply_details_example, :onix_series_memberships_example, :onix_supporting_resources_example,
|
18
21
|
:onix_elibri_extensions_example, :contributor_mock, :review_mock, :supply_detail_mock, :imprint_mock,
|
19
22
|
:description_mock
|
@@ -41,6 +44,219 @@ describe Elibri::XmlMocks::Examples do
|
|
41
44
|
message.products.first.subjects.size.should == 0
|
42
45
|
|
43
46
|
end
|
44
|
-
|
47
|
+
|
48
|
+
NAME_STRING_VECTOR = {
|
49
|
+
:ean => :ean,
|
50
|
+
:isbn_value => :isbn13,
|
51
|
+
:publisher_name => :publisher_name,
|
52
|
+
:title => :title,
|
53
|
+
:subtitle => :subtitle,
|
54
|
+
[:collection, Proc.new { Elibri::XmlMocks::Examples.collection_mock(:name => 'nazwa') } ] => [:collection_title, 'nazwa'],
|
55
|
+
# [ :atrybut do podania do mocka, proc ktory wygeneruje mock ] => [ :atrybut w elibri, wartosc oczekiwana ]
|
56
|
+
:collection_part => :collection_part,
|
57
|
+
:or_title => :original_title,
|
58
|
+
:trade_title => :trade_title,
|
59
|
+
[ :sale_restricted_to, Proc.new { Date.new(2011, 1, 1) } ] => [ :parsed_publishing_date, [2011, 1, 1] ],
|
60
|
+
:record_reference => :record_reference,
|
61
|
+
:deletion_text => :deletion_text,
|
62
|
+
:pkwiu => :pkwiu,
|
63
|
+
:edition_statement => :edition_statement
|
64
|
+
}
|
45
65
|
|
66
|
+
NAME_STRING_VECTOR.keys.each do |property|
|
67
|
+
|
68
|
+
|
69
|
+
it "should create properly string attribute #{property} inside product and should it parse properly" do
|
70
|
+
if property.is_a?(Array)
|
71
|
+
product = Elibri::XmlMocks::Examples.book_example(property[0] => property[1].call)
|
72
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
73
|
+
message.products.first.send(NAME_STRING_VECTOR[property][0]).should eq(NAME_STRING_VECTOR[property][1])
|
74
|
+
else
|
75
|
+
product = Elibri::XmlMocks::Examples.book_example(property => '1')
|
76
|
+
product.send(property).should eq('1')
|
77
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
78
|
+
message.products.first.send(NAME_STRING_VECTOR[property]).should eq('1')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
NAME_INT_VECTOR = {
|
85
|
+
:publisher_id => :publisher_id,
|
86
|
+
:audience_age_from => :reading_age_from,
|
87
|
+
:audience_age_to => :reading_age_to,
|
88
|
+
:vat => :vat,
|
89
|
+
:number_of_illustrations => :number_of_illustrations,
|
90
|
+
:number_of_pages => :number_of_pages,
|
91
|
+
:duration => :duration,
|
92
|
+
:file_size => :file_size,
|
93
|
+
### atrybuty powiązane z kind_of_measurable
|
94
|
+
#:width => :width,
|
95
|
+
#:weight => :weight,
|
96
|
+
#:thickness => :thickness,
|
97
|
+
#:height => :height,
|
98
|
+
}
|
99
|
+
|
100
|
+
NAME_INT_VECTOR.keys.each do |property|
|
101
|
+
|
102
|
+
it "should create properly integer attribute #{property} inside product and should it parse properly" do
|
103
|
+
product = Elibri::XmlMocks::Examples.book_example(property => 1)
|
104
|
+
product.send(property).should eq(1)
|
105
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
106
|
+
message.products.first.send(NAME_INT_VECTOR[property]).should eq(1)
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should create properly attribute current_state inside product and should it parse properly" do
|
112
|
+
product = Elibri::XmlMocks::Examples.book_example(:notification_type => '04')
|
113
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
114
|
+
message.products.first.send(:current_state).should eq(:published)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should create imprint attribute inside product and should it parse properly" do
|
118
|
+
imprint = Elibri::XmlMocks::Examples.imprint_mock(:name => 'Imprint Mock')
|
119
|
+
product = Elibri::XmlMocks::Examples.book_example(:imprint => imprint)
|
120
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
121
|
+
message.products.first.send(:imprint).class.should eq(Elibri::ONIX::Release_3_0::Imprint)
|
122
|
+
message.products.first.send(:imprint).send(:name).should eq('Imprint Mock')
|
123
|
+
message.products.first.send(:imprint_name).should eq('Imprint Mock')
|
124
|
+
end
|
125
|
+
|
126
|
+
it "should create full_title inside product based on other fields" do
|
127
|
+
collection = Elibri::XmlMocks::Examples.collection_mock(:name => 'Kolekcja książek')
|
128
|
+
product = Elibri::XmlMocks::Examples.book_example(
|
129
|
+
:title => "Numer jeden", :subtitle => 'Książka nawiedzona',
|
130
|
+
:edition_statement => 'wyd. 1, zepsute', :collection => collection,
|
131
|
+
:collection_part => 'Część 123')
|
132
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
133
|
+
message.products.first.send(:full_title).should eq('Kolekcja książek (Część 123). Numer jeden. Książka nawiedzona')
|
134
|
+
end
|
135
|
+
|
136
|
+
it "should create cover_price attribute inside product and should it parse properly" do
|
137
|
+
product = Elibri::XmlMocks::Examples.book_example(:price_amount => 9.99)
|
138
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
139
|
+
message.products.first.send(:cover_price).should eq(9.99)
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should create publisher_name attribute inside product and should it parse properly" do
|
143
|
+
product = Elibri::XmlMocks::Examples.book_example(:publisher_name => 'Wydawnictwo')
|
144
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
145
|
+
message.products.first.send(:publisher_name).should eq('Wydawnictwo')
|
146
|
+
message.products.first.send(:publisher).send(:name).should eq('Wydawnictwo')
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should create no_contributors attribute inside product and should it parse properly" do
|
150
|
+
product = Elibri::XmlMocks::Examples.book_example
|
151
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
152
|
+
message.products.first.send(:no_contributor?).should eq(false)
|
153
|
+
authorship_kind = Elibri::XmlMocks::Examples.authorship_kind_mock(:no_contributor? => true)
|
154
|
+
product = Elibri::XmlMocks::Examples.book_example(:authorship_kind => authorship_kind)
|
155
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
156
|
+
message.products.first.send(:no_contributor?).should eq(true)
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should create publishing_date and attribute inside product and should it parse properly" do
|
160
|
+
product = Elibri::XmlMocks::Examples.book_example(
|
161
|
+
:publication_day => 1, :publication_month => 1, :publication_year => 2010, :sale_restricted_to => Date.new(2010,1,1))
|
162
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
163
|
+
pub_date = message.products.first.send(:publishing_date)
|
164
|
+
pub_date.class.should eq(Elibri::ONIX::Release_3_0::PublishingDate)
|
165
|
+
pub_date.date.should eq('20100101')
|
166
|
+
message.products.first.send(:premiere).should eq(Date.new(2010,1,1))
|
167
|
+
end
|
168
|
+
|
169
|
+
it "should create preview_exists and should it parse properly" do
|
170
|
+
product = Elibri::XmlMocks::Examples.book_example(:preview_exists? => true)
|
171
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
172
|
+
message.products.first.send(:preview_exists).should eq(true)
|
173
|
+
product = Elibri::XmlMocks::Examples.book_example(:preview_exists? => false)
|
174
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
175
|
+
message.products.first.send(:preview_exists).should eq(false)
|
176
|
+
product = Elibri::XmlMocks::Examples.book_example
|
177
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
178
|
+
message.products.first.send(:preview_exists).should eq(false)
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should create product_composition and should it parse properly (but always 00 right now)" do
|
182
|
+
product = Elibri::XmlMocks::Examples.book_example(:product_composition => '00')
|
183
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
184
|
+
message.products.first.send(:product_composition).should eq('00')
|
185
|
+
product = Elibri::XmlMocks::Examples.book_example(:product_composition => 'asd')
|
186
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
187
|
+
message.products.first.send(:product_composition).should eq('00')
|
188
|
+
end
|
189
|
+
|
190
|
+
it "should create product_form and should it parse properly" do
|
191
|
+
product = Elibri::XmlMocks::Examples.book_example(:product_form_onix_code => 'EA')
|
192
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
193
|
+
message.products.first.send(:product_form).should eq('EA')
|
194
|
+
product = Elibri::XmlMocks::Examples.book_example(:product_form_onix_code => 'BA')
|
195
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
196
|
+
message.products.first.send(:product_form).should eq('BA')
|
197
|
+
end
|
198
|
+
|
199
|
+
it "should create publishing_status and should it parse properly" do
|
200
|
+
product = Elibri::XmlMocks::Examples.book_example(:publishing_status_onix_code => Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode::ACTIVE)
|
201
|
+
product.publishing_status_onix_code.should eq(Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode::ACTIVE)
|
202
|
+
product.publishing_status_onix_code.present?.should eq(true)
|
203
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
204
|
+
message.products.first.send(:publishing_status).should eq(Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode::ACTIVE)
|
205
|
+
### dlaczego nie zmienia sie status?
|
206
|
+
# product = Elibri::XmlMocks::Examples.book_example(:publishing_status_onix_code => Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode::FORTHCOMING)
|
207
|
+
# product.publishing_status_onix_code.should eq(Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode::FORTHCOMING)
|
208
|
+
# product.publishing_status_onix_code.present?.should eq(true)
|
209
|
+
# message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
210
|
+
# message.products.first.send(:publishing_status).should eq(Elibri::ONIX::Dict::Release_3_0::PublishingStatusCode::FORTHCOMING)
|
211
|
+
end
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
it "should create series_name attribute inside product and should it parse properly" do
|
216
|
+
product = Elibri::XmlMocks::Examples.onix_series_memberships_example
|
217
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
218
|
+
message.products.first.send(:series_names).should eq(['Lektury szkolne','Dla Bystrzaków'])
|
219
|
+
end
|
220
|
+
|
221
|
+
it "should create series attribute inside product and should it parse properly" do
|
222
|
+
product = Elibri::XmlMocks::Examples.onix_series_memberships_example
|
223
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
224
|
+
message.products.first.send(:series).should eq([['Lektury szkolne', '2'], ['Dla Bystrzaków', '1']])
|
225
|
+
end
|
226
|
+
|
227
|
+
it "should create text_contents with types inside product and parse it properly" do
|
228
|
+
texts = [
|
229
|
+
Elibri::XmlMocks::Examples.description_mock(:type_onix_code => Elibri::ONIX::Dict::Release_3_0::OtherTextType::REVIEW, :text => 'review'),
|
230
|
+
Elibri::XmlMocks::Examples.description_mock(:type_onix_code => Elibri::ONIX::Dict::Release_3_0::OtherTextType::EXCERPT, :text => 'excerpt'),
|
231
|
+
Elibri::XmlMocks::Examples.description_mock(:type_onix_code => Elibri::ONIX::Dict::Release_3_0::OtherTextType::TABLE_OF_CONTENTS, :text => 'toc'),
|
232
|
+
Elibri::XmlMocks::Examples.description_mock(:type_onix_code => Elibri::ONIX::Dict::Release_3_0::OtherTextType::SHORT_DESCRIPTION, :text => 'short description'),
|
233
|
+
Elibri::XmlMocks::Examples.description_mock(:type_onix_code => Elibri::ONIX::Dict::Release_3_0::OtherTextType::MAIN_DESCRIPTION, :text => 'description')
|
234
|
+
]
|
235
|
+
product = Elibri::XmlMocks::Examples.book_example(:other_texts => texts)
|
236
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
237
|
+
message.products.first.send(:reviews).first.text.should eq('review')
|
238
|
+
message.products.first.send(:excerpts).first.text.should eq('excerpt')
|
239
|
+
message.products.first.send(:table_of_contents).text.should eq('toc')
|
240
|
+
message.products.first.send(:description).text.should eq('description')
|
241
|
+
message.products.first.send(:short_description).text.should eq('short description')
|
242
|
+
end
|
243
|
+
|
244
|
+
it "should create proper front_cover inside item" do
|
245
|
+
product = Elibri::XmlMocks::Examples.book_example
|
246
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
247
|
+
message.products.first.send(:front_cover).send(:link).should eq('http://elibri.com.pl/sciezka/do/pliku.png')
|
248
|
+
end
|
249
|
+
|
250
|
+
=begin
|
251
|
+
|
252
|
+
it "should create product with similars" do
|
253
|
+
product = Elibri::XmlMocks::Examples.product_with_similars_mock
|
254
|
+
message = Elibri::ONIX::Release_3_0::ONIXMessage.from_xml(Elibri::ONIX::XMLGenerator.new(product).to_s)
|
255
|
+
debugger
|
256
|
+
message.products.first.should eq('asdf')
|
257
|
+
|
258
|
+
end
|
259
|
+
|
260
|
+
=end
|
261
|
+
|
46
262
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elibri_onix_mocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Piotr Szmielew
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-17 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
type: :development
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
35
|
+
name: ruby-debug
|
36
36
|
prerelease: false
|
37
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
38
|
none: false
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
type: :development
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: rake
|
50
50
|
prerelease: false
|
51
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
@@ -57,10 +57,10 @@ dependencies:
|
|
57
57
|
segments:
|
58
58
|
- 0
|
59
59
|
version: "0"
|
60
|
-
type: :
|
60
|
+
type: :development
|
61
61
|
version_requirements: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: elibri_onix
|
64
64
|
prerelease: false
|
65
65
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
type: :runtime
|
75
75
|
version_requirements: *id004
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: elibri_onix_generator
|
78
78
|
prerelease: false
|
79
79
|
requirement: &id005 !ruby/object:Gem::Requirement
|
80
80
|
none: false
|
@@ -88,7 +88,7 @@ dependencies:
|
|
88
88
|
type: :runtime
|
89
89
|
version_requirements: *id005
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
91
|
+
name: elibri_onix_dict
|
92
92
|
prerelease: false
|
93
93
|
requirement: &id006 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
@@ -102,7 +102,7 @@ dependencies:
|
|
102
102
|
type: :runtime
|
103
103
|
version_requirements: *id006
|
104
104
|
- !ruby/object:Gem::Dependency
|
105
|
-
name:
|
105
|
+
name: elibri_api_client
|
106
106
|
prerelease: false
|
107
107
|
requirement: &id007 !ruby/object:Gem::Requirement
|
108
108
|
none: false
|
@@ -116,7 +116,7 @@ dependencies:
|
|
116
116
|
type: :runtime
|
117
117
|
version_requirements: *id007
|
118
118
|
- !ruby/object:Gem::Dependency
|
119
|
-
name:
|
119
|
+
name: mocha
|
120
120
|
prerelease: false
|
121
121
|
requirement: &id008 !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
@@ -129,6 +129,34 @@ dependencies:
|
|
129
129
|
version: "0"
|
130
130
|
type: :runtime
|
131
131
|
version_requirements: *id008
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: builder
|
134
|
+
prerelease: false
|
135
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
hash: 3
|
141
|
+
segments:
|
142
|
+
- 0
|
143
|
+
version: "0"
|
144
|
+
type: :runtime
|
145
|
+
version_requirements: *id009
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: activesupport
|
148
|
+
prerelease: false
|
149
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
hash: 3
|
155
|
+
segments:
|
156
|
+
- 0
|
157
|
+
version: "0"
|
158
|
+
type: :runtime
|
159
|
+
version_requirements: *id010
|
132
160
|
description: "Usage: Elibri::XmlGenerator.basic_product etc"
|
133
161
|
email:
|
134
162
|
- p.szmielew@ava.waw.pl
|