add validity test, a simple one
This commit is contained in:
parent
63f0c65bb7
commit
c98aad1e6e
@ -161,6 +161,10 @@ module AVM
|
|||||||
@observations = []
|
@observations = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def valid?
|
||||||
|
self.headline && self.credit
|
||||||
|
end
|
||||||
|
|
||||||
def create_observation(options)
|
def create_observation(options)
|
||||||
observation = Observation.new(self, options)
|
observation = Observation.new(self, options)
|
||||||
@observations << observation
|
@observations << observation
|
||||||
|
@ -21,6 +21,8 @@ describe AVM::Image do
|
|||||||
let(:redshift) { 'Redshift' }
|
let(:redshift) { 'Redshift' }
|
||||||
let(:light_years) { 'Light years' }
|
let(:light_years) { 'Light years' }
|
||||||
|
|
||||||
|
let(:subject_names) { [ 'Name one', 'Name two' ] }
|
||||||
|
|
||||||
let(:coordinate_frame) { 'ICRS' }
|
let(:coordinate_frame) { 'ICRS' }
|
||||||
let(:equinox) { '100' }
|
let(:equinox) { '100' }
|
||||||
let(:reference_value) { [ 100, 50 ] }
|
let(:reference_value) { [ 100, 50 ] }
|
||||||
@ -119,6 +121,8 @@ describe AVM::Image do
|
|||||||
its(:related_resources) { should == related_resources }
|
its(:related_resources) { should == related_resources }
|
||||||
its(:metadata_date) { should == Time.parse(metadata_date) }
|
its(:metadata_date) { should == Time.parse(metadata_date) }
|
||||||
its(:metadata_version) { should == metadata_version }
|
its(:metadata_version) { should == metadata_version }
|
||||||
|
|
||||||
|
it { should be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#initialize' do
|
describe '#initialize' do
|
||||||
@ -166,6 +170,12 @@ describe AVM::Image do
|
|||||||
its(:distance) { should == [ light_years, redshift ] }
|
its(:distance) { should == [ light_years, redshift ] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'not valid' do
|
||||||
|
let(:image) { AVM::Image.new }
|
||||||
|
|
||||||
|
it { should_not be_valid }
|
||||||
|
end
|
||||||
|
|
||||||
describe '.from_xml' do
|
describe '.from_xml' do
|
||||||
let(:image) { AVM::Image.from_xml(File.read(file_path)) }
|
let(:image) { AVM::Image.from_xml(File.read(file_path)) }
|
||||||
|
|
||||||
@ -184,6 +194,8 @@ describe AVM::Image do
|
|||||||
].each do |field|
|
].each do |field|
|
||||||
its(field) { should be_nil }
|
its(field) { should be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it { should_not be_valid }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "image in it" do
|
context "image in it" do
|
||||||
|
Loading…
Reference in New Issue
Block a user