A Ruby gem to get planning applications data from UK council websites.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

58 Zeilen
1.2 KiB

  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(112)
  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 (:tagged_london) { described_class.tagged('london') }
  31. it 'returns all London authorities' do
  32. expect(tagged_london.count).to eq(35)
  33. end
  34. let (:tagged_londonboroughs) { described_class.tagged('londonboroughs') }
  35. it 'returns all London boroughs' do
  36. expect(tagged_londonboroughs.count).to eq(32)
  37. end
  38. end
  39. end