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.

authority_spec.rb 1.3 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. require 'spec_helper'
  2. describe UKPlanningScraper::Authority do
  3. describe '#named' do
  4. subject(:authority) { UKPlanningScraper::Authority.named(name) }
  5. context 'when authority exists' do
  6. let(: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(: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) { UKPlanningScraper::Authority.all }
  20. it 'returns more than 100 authorities' do
  21. expect(all.count).to be > 100
  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. describe '#tagged' do
  30. let (:authority) { UKPlanningScraper::Authority.tagged(tag) }
  31. context 'when tagged london' do
  32. let(:tag) { 'london' }
  33. it 'returns all 35 London authorities' do
  34. expect(authority.count).to eq(35)
  35. end
  36. end
  37. context 'when tagged londonboroughs' do
  38. let(:tag) { 'londonboroughs' }
  39. it 'returns all 32 London boroughs' do
  40. expect(authority.count).to eq(32)
  41. end
  42. end
  43. end
  44. end