Skip to content

Commit

Permalink
SRCH-75 upgrade to ruby 2.5.5 (#332)
Browse files Browse the repository at this point in the history
- bump scrypt
- add missing spec for RejectInvalidRequestUri
- remove redundant Dockerize installation for CircleCi
  • Loading branch information
MothOnMars authored Aug 12, 2019
1 parent 2034620 commit 7a7ba8e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ executors:

docker:
# using custom image, see .circleci/images/primary/Dockerfile
- image: searchgov/circleci:20190320
- image: searchgov/circleci:20190417
environment:
RAILS_ENV: test

Expand Down
9 changes: 1 addition & 8 deletions .circleci/images/primary/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# using legacy image for phantomjs
FROM circleci/ruby:2.3.8-browsers-legacy
FROM circleci/ruby:2.5.5-browsers-legacy

USER root

Expand All @@ -8,11 +8,4 @@ RUN apt-get update && apt-get install -y \
libprotobuf-dev \
protobuf-compiler

# Install Dockerize to ensure services are started before test runs
# https://support.circleci.com/hc/en-us/articles/360006773953-Race-Conditions-Wait-For-Database
ENV DOCKERIZE_VERSION v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz

USER circleci
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.3.8
ruby-2.5.5
8 changes: 5 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ working development environment for Rails up and running, including the database

## Ruby

You will need Ruby 2.3.8 Verify that your path points to the correct version of Ruby:
You will need the version of Ruby specified in `.ruby-version`. Verify that your path points to the correct version of Ruby:

devbox:usasearch
$ ruby -v
ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-darwin16]

You should see output similar to the following:

ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-darwin18]

## Packages

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/sites/query_downloads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def top_queries
def ctr(click_count, query_count)
return '--' if click_count == 0 || query_count == 0

sprintf("%.1f%", click_count.to_f * 100 / query_count)
sprintf('%.1f%%', click_count.to_f * 100 / query_count)
end

def date_range_top_n_query
Expand Down
13 changes: 11 additions & 2 deletions spec/lib/middlewares/reject_invalid_request_uri_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@
let(:app) { double('app') }
let(:middleware) { RejectInvalidRequestUri.new(app) }
let(:env) { { 'REQUEST_URI' => "/search?query=\xC0" } }
let(:response) { middleware.call(env) }
let(:status) { response.first }

it 'should return with status 400' do
status, header, body = middleware.call env
it 'returns a 400 status' do
expect(status).to eq(400)
end

context 'when invalid arguments are passed' do
before { allow(CGI).to receive(:unescape).and_raise(ArgumentError) }

it 'returns a 400 status' do
expect(status).to eq(400)
end
end
end
end

0 comments on commit 7a7ba8e

Please sign in to comment.