Skip to content

Commit 757ce64

Browse files
authored
fix(appengine/standard-storage): refactor capybara testing (#1526)
* debug: attempt to refactor capybara testing * fix: move newline
1 parent 6a1bdb1 commit 757ce64

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-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+
24+
# [START gae_standard_storage_app]
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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
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})
24+
end
2325
end
2426
it "can upload and get public URL of uploaded file" do
2527
Capybara.app = Sinatra::Application
@@ -31,7 +33,7 @@
3133

3234
uploaded_file_public_url = page.find("body").text
3335

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

0 commit comments

Comments
 (0)