-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SRCH-1511 SRCH-1560 improve error handling in SitemapIndexer (#603)
- move observers into relevant directories
- Loading branch information
1 parent
b9d85f1
commit 20e1646
Showing
15 changed files
with
85 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,41 @@ | ||
require 'spec_helper' | ||
|
||
describe Sitemap do | ||
pending('until the sitemapindexer gem file is updated for rails 5 ') do | ||
let(:url) { 'http://agency.gov/sitemap.xml' } | ||
let(:valid_attributes) { { url: url } } | ||
let(:url) { 'http://agency.gov/sitemap.xml' } | ||
let(:valid_attributes) { { url: url } } | ||
|
||
it { is_expected.to have_readonly_attribute(:url) } | ||
it { is_expected.to have_readonly_attribute(:url) } | ||
|
||
describe 'schema' do | ||
it do | ||
is_expected.to have_db_column(:url).of_type(:string). | ||
with_options(null: false, limit: 2000) | ||
end | ||
describe 'schema' do | ||
it do | ||
is_expected.to have_db_column(:url).of_type(:string). | ||
with_options(null: false, limit: 2000) | ||
end | ||
end | ||
|
||
describe 'validations' do | ||
context 'when validating url uniqueness' do | ||
let!(:original) { Sitemap.create!(valid_attributes) } | ||
describe 'validations' do | ||
context 'when validating url uniqueness' do | ||
let!(:original) { Sitemap.create!(valid_attributes) } | ||
|
||
it 'rejects duplicate urls' do | ||
expect(Sitemap.new(valid_attributes)).to_not be_valid | ||
end | ||
it 'rejects duplicate urls' do | ||
expect(Sitemap.new(valid_attributes)).to_not be_valid | ||
end | ||
|
||
it 'is not case-sensitive' do | ||
expect(Sitemap.create!(url: url.upcase)).to be_valid | ||
end | ||
it 'is not case-sensitive' do | ||
expect(Sitemap.create!(url: url.upcase)).to be_valid | ||
end | ||
end | ||
end | ||
|
||
describe 'lifecycle' do | ||
describe 'on create' do | ||
it 'is automatically indexed' do | ||
expect(SitemapIndexerJob).to receive(:perform_later).with(sitemap_url: url) | ||
Sitemap.create!(url: url) | ||
end | ||
describe 'lifecycle' do | ||
describe 'on create' do | ||
it 'is automatically indexed' do | ||
expect(SitemapIndexerJob).to receive(:perform_later).with(sitemap_url: url) | ||
Sitemap.create!(url: url) | ||
end | ||
end | ||
|
||
it_should_behave_like 'a record with a fetchable url' | ||
it_should_behave_like 'a record that belongs to a searchgov_domain' | ||
end | ||
|
||
it_should_behave_like 'a record with a fetchable url' | ||
it_should_behave_like 'a record that belongs to a searchgov_domain' | ||
end |
File renamed without changes.