A Ruby gem to get planning applications data from UK council websites.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
937 B

  1. require 'spec_helper'
  2. describe UKPlanningScraper::Authority do
  3. describe '#named' do
  4. let(:authority) { described_class.named(authority_name) }
  5. context 'when authority exists' do
  6. let(:authority_name) { 'Westminster' }
  7. it 'returns an authority' do
  8. expect(authority).to be_a(UKPlanningScraper::Authority)
  9. end
  10. end
  11. context 'when authority does not exist' do
  12. let(:authority_name) { 'Westmonster' }
  13. it 'raises an error' do
  14. expect { authority }.to raise_error(UKPlanningScraper::AuthorityNotFound)
  15. end
  16. end
  17. end
  18. describe '#all' do
  19. let(:all) { described_class.all }
  20. it 'returns all authorities' do
  21. expect(all.count).to eq(48)
  22. end
  23. it 'returns a list of authorities' do
  24. all.each do |authority|
  25. expect(authority).to be_a(UKPlanningScraper::Authority)
  26. end
  27. end
  28. end
  29. end