diff --git a/lib/avm/image.rb b/lib/avm/image.rb
index e8effa2..1641ef5 100644
--- a/lib/avm/image.rb
+++ b/lib/avm/image.rb
@@ -94,14 +94,14 @@ module AVM
end
if node = refs[:avm].at_xpath('./avm:Distance')
- list_values = node.search('.//ref:li').collect { |li| li.text }
+ list_values = node.search('.//rdf:li').collect { |li| li.text }
case list_values.length
when 1
options[:light_years] = list_values.first
when 2
options[:light_years] = (list_values.first == '-') ? nil : list_values.first
- options[:redshift] = list_valueslast
+ options[:redshift] = list_values.last
end
end
end
diff --git a/spec/avm/image_spec.rb b/spec/avm/image_spec.rb
index 892930a..5f914d7 100644
--- a/spec/avm/image_spec.rb
+++ b/spec/avm/image_spec.rb
@@ -90,23 +90,27 @@ describe AVM::Image do
has_most_options
its(:redshift) { should be_nil }
+ its(:light_years) { should == light_years }
end
context "distaince in redshift" do
-
- let(:file_path) { 'spec/sample_files/image/redshift.xmp' }
- end
- context "distance in both" do
-
- let(:file_path) { 'spec/sample_files/image/both.xmp' }
+ let(:file_path) { 'spec/sample_files/image/redshift.xmp' }
+ has_most_options
+
+ its(:light_years) { should be_nil }
+ its(:redshift) { should == redshift }
end
- context "distance in neither" do
-
- let(:file_path) { 'spec/sample_files/image/neither.xmp' }
+
+ context "distance in both" do
+ let(:file_path) { 'spec/sample_files/image/both.xmp' }
+
+ has_most_options
+
+ its(:light_years) { should == light_years }
+ its(:redshift) { should == redshift }
end
end
-
end
describe '#to_xml' do
diff --git a/spec/sample_files/image/both.xmp b/spec/sample_files/image/both.xmp
new file mode 100644
index 0000000..6f62e8e
--- /dev/null
+++ b/spec/sample_files/image/both.xmp
@@ -0,0 +1,43 @@
+
+
+
+ :
+
+ My title
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+
+ Headline
+
+
+ Distance Notes
+ Reference URL
+ Credit
+ 2010-01-01
+ ID
+ Observation
+ Good
+
+
+ Light years
+ Redshift
+
+
+
+
+
diff --git a/spec/sample_files/image/light_years.xmp b/spec/sample_files/image/light_years.xmp
index b32eb55..becc7b8 100644
--- a/spec/sample_files/image/light_years.xmp
+++ b/spec/sample_files/image/light_years.xmp
@@ -32,6 +32,7 @@
ID
Observation
Good
+ Light years
diff --git a/spec/sample_files/image/redshift.xmp b/spec/sample_files/image/redshift.xmp
new file mode 100644
index 0000000..e86c9b4
--- /dev/null
+++ b/spec/sample_files/image/redshift.xmp
@@ -0,0 +1,43 @@
+
+
+
+ :
+
+ My title
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+
+ Headline
+
+
+ Distance Notes
+ Reference URL
+ Credit
+ 2010-01-01
+ ID
+ Observation
+ Good
+
+
+ -
+ Redshift
+
+
+
+
+