A Ruby gem to get planning applications data from UK council websites.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

58 linhas
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(73)
  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