spec/lib/percy/capybara/loaders/sprockets_loader_spec.rb in percy-capybara-1.1.0 vs spec/lib/percy/capybara/loaders/sprockets_loader_spec.rb in percy-capybara-1.2.0

- old
+ new

@@ -53,7 +53,21 @@ it 'returns "build resources" from filtered sprockets paths' do resources = loader.build_resources expect(resources.map { |r| r.resource_url }).to eq(["/assets/css/base.css"]) expect(resources.first.content).to include('.colored-by-base') end + context 'Rails app' do + it 'includes files from the public folder (non-asset-pipeline)' do + + # Pretend like we're in a Rails app right now, all we care about is Rails.public_path. + rails_double = double('Rails') + # Pretend like the entire testdata directory is the public/ folder. + expect(rails_double).to receive(:public_path).and_return(environment.root) + expect(loader).to receive(:_rails).at_least(:once).and_return(rails_double) + + resources = loader.build_resources + expect(resources.length).to be > 5 # Weak test that more things are in this list. + expect(resources.map { |r| r.resource_url }).to include('/images/percy.svg') + end + end end end