Sha256: d1603bb28b9b3f99129de60c4856797327bedbd9e8e1ecf2de56c9bb45576a9b
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' module Landable describe Directory, '.listing' do def stub_contents ['/seo/foo', '/aff/bar', '/seo/baz', '/aff/deeply/nested', '/aff/deeply_nested', '/quux'].each do |path| create :page, path: path end end it 'knows its own path' do dir = Directory.listing '/' dir.path.should eq '/' end it 'lists immediate children' do stub_contents dir = Directory.listing '/' dir.subdirectories.map(&:path).should eq ['/aff', '/seo'] dir.pages.map(&:path).should eq ['/quux'] dir = Directory.listing '/aff' dir.subdirectories.map(&:path).should eq ['/aff/deeply'] dir.pages.map(&:path).should eq ['/aff/bar', '/aff/deeply_nested'] dir = Directory.listing '/seo' dir.subdirectories.should be_empty dir.pages.map(&:path).should eq ['/seo/baz', '/seo/foo'] dir = Directory.listing '/aff/deeply' dir.subdirectories.should be_empty dir.pages.map(&:path).should eq ['/aff/deeply/nested'] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
landable-1.14.0 | spec/models/landable/directory_spec.rb |
landable-1.13.2 | spec/models/landable/directory_spec.rb |