Skip to content

Instantly share code, notes, and snippets.

@macool
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macool/cb80c634b8a5ce37208f to your computer and use it in GitHub Desktop.
Save macool/cb80c634b8a5ce37208f to your computer and use it in GitHub Desktop.
spec
describe 'If a geographical area has a parent geographical area group then the
validity period of the parent geographical area group must span the validity
period of the geographical area' do
describe "GA5" do
let(:geographical_area) {
build(:geographical_area,
validity_end_date: Date.today,
parent_geographical_area_group_sid: parent_id)
}
before { geographical_area.conformant? }
context "invalid parent period" do
context "start date" do
let(:parent_id) {
create(:geographical_area, validity_start_date: Date.yesterday)
}
it {
expect(geographical_area.conformance_errors).to have_key(:GA5)
}
end
context "end date" do
let(:parent_id) {
create(:geographical_area, validity_end_date: Date.yesterday )
}
it {
expect(geographical_area.conformance_errors).to have_key(:GA5)
}
end
end
context "valid" do
let(:parent_id) {
create(:geographical_area, validity_end_date: Date.today)
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment