Skip to content

Commit 18a4740

Browse files
committed
debug: attempt to refactor capybara testing
1 parent 6a1bdb1 commit 18a4740

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

appengine/standard-storage/app.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
require "sinatra"
1717
require "google/cloud/storage"
1818

19+
# [END gae_standard_storage_app]
20+
configure :development do
21+
set :host_authorization, { permitted_hosts: [] }
22+
end
23+
# [START gae_standard_storage_app]
24+
1925
storage = Google::Cloud::Storage.new
2026
bucket = storage.bucket ENV["GOOGLE_CLOUD_STORAGE_BUCKET"]
2127

appengine/standard-storage/spec/storage_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
describe "Cloud Storage", type: :feature do
2121
before do
22-
Capybara.current_driver = :cuprite
22+
Capybara.register_driver :cuprite do |app|
23+
Capybara::Cuprite::Driver.new(app, browser_options: {'no-sandbox': nil})
2324
end
2425
it "can upload and get public URL of uploaded file" do
2526
Capybara.app = Sinatra::Application
@@ -31,7 +32,7 @@
3132

3233
uploaded_file_public_url = page.find("body").text
3334

34-
visit uploaded_file_public_url
35-
expect(page).to have_content "This is the content of the test-upload.txt file"
35+
page = Net::HTTP.get_response(URI(uploaded_file_public_url))
36+
expect(page).to include "This is the content of the test-upload.txt file"
3637
end
3738
end

0 commit comments

Comments
 (0)