Guest User

Untitled

a guest
Jun 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. require_relative '../lib/location_builder.rb'
  2. include LocationBuilder
  3.  
  4. describe LocationBuilder do
  5.  
  6. describe 'when parsing a single simple Location' do
  7. before do
  8. @locations = parse('specs/data/simple_location.rb')
  9. @location = @locations.first
  10. end
  11.  
  12. it 'returns a single Location' do
  13. @locations.length.should == 1
  14. end
  15.  
  16. it 'returns a Location that has the specified name' do
  17. @location.name.should == :town
  18. end
  19.  
  20. it 'returns a Location that has the specified long name' do
  21. @location.long_name.should == 'Viva La Vegas'
  22. end
  23.  
  24. it 'returns a Location that has the specified description' do
  25. @location.description.should == 'A great town.'
  26. end
  27.  
  28. it 'returns a Location with no actions' do
  29. @location.has_action(:any).should == false
  30. end
  31.  
  32. it 'returns a Location with no parent Location' do
  33. @location.parent_location.should == nil
  34. end
  35.  
  36. it 'still returns only a single Location' do
  37. @locations.length.should == 1
  38. end
  39. end
  40.  
  41. describe 'when parsing hierarchical Locations' do
  42. before do
  43. @locations = parse('specs/data/hierarchical_locations.rb')
  44. end
  45.  
  46. it 'returns the correct number of Locations' do
  47. @locations.length.should == 5
  48. end
  49.  
  50. it 'returns the described Locations' do
  51. names = @locations.map {|location| location.name}
  52. names.should include(:street, :park, :bank, :house, :door)
  53. end
  54. end
  55. end
Add Comment
Please, Sign In to add comment