diff --git a/Gemfile b/Gemfile index fde95c2d6..51c732110 100644 --- a/Gemfile +++ b/Gemfile @@ -58,7 +58,7 @@ gem "rack-utf8_sanitizer", "~> 1.6" gem "turnout", "~> 2.5" gem "audited", "~> 4.8" gem "git", "~> 1.5" -gem "graphql", "~> 1.9", ">= 1.9.16" +gem "graphql", "~> 1.9.16" gem "graphql-errors", "~> 0.4.0" gem "graphql-batch", "~> 0.4.1" gem "batch-loader", "~> 1.4", ">= 1.4.1" @@ -71,6 +71,7 @@ gem 'strong_migrations', '~> 0.6.0' gem 'crawler_detect' gem 'lhm', '~> 2.2' gem 'kt-paperclip', '~> 6.2', '>= 6.2.2' +gem 'kaminari', '~> 1.2' group :development, :test do gem "rspec-rails", "~> 3.8", ">= 3.8.2" diff --git a/Gemfile.lock b/Gemfile.lock index 06b96bf19..933ff091e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,24 +52,24 @@ GEM addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) ansi (1.5.0) - apollo-federation (1.0.3) + apollo-federation (1.0.4) google-protobuf (~> 3.7) - graphql (~> 1.9.8) + graphql (>= 1.9.8) arel (9.0.0) ast (2.4.0) audited (4.9.0) activerecord (>= 4.2, < 6.1) - aws-eventstream (1.0.3) - aws-partitions (1.289.0) - aws-sdk-core (3.92.0) - aws-eventstream (~> 1.0, >= 1.0.2) + aws-eventstream (1.1.0) + aws-partitions (1.297.0) + aws-sdk-core (3.94.0) + aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) aws-sdk-kms (1.30.0) aws-sdk-core (~> 3, >= 3.71.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.61.1) + aws-sdk-s3 (1.61.2) aws-sdk-core (~> 3, >= 3.83.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) @@ -98,7 +98,7 @@ GEM coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) - bibtex-ruby (5.1.2) + bibtex-ruby (5.1.4) latex-decode (~> 0.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) @@ -135,7 +135,7 @@ GEM uniform_notifier (~> 1.11) byebug (11.1.1) cancancan (2.3.0) - capybara (3.31.0) + capybara (3.32.1) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -175,7 +175,7 @@ GEM css_parser (1.7.1) addressable dalli (2.7.10) - database_cleaner (1.8.3) + database_cleaner (1.8.4) ddtrace (0.32.0) msgpack debug_inspector (0.0.3) @@ -199,11 +199,11 @@ GEM elasticsearch-extensions (0.0.31) ansi elasticsearch - elasticsearch-model (7.0.0) + elasticsearch-model (7.1.0) activesupport (> 3) elasticsearch (> 1) hashie - elasticsearch-rails (7.0.0) + elasticsearch-rails (7.1.0) elasticsearch-transport (7.1.0) faraday multi_json @@ -308,7 +308,7 @@ GEM logstash-event (1.2.02) logstash-logger (0.26.1) logstash-event (~> 1.2) - loofah (2.4.0) + loofah (2.5.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) macaddr (1.7.2) @@ -350,12 +350,12 @@ GEM nio4r (2.5.2) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) - oj (3.10.5) + oj (3.10.6) oj_mimic_json (1.0.1) optimist (3.0.0) pandoc-ruby (2.1.4) parallel (1.19.1) - parser (2.7.0.5) + parser (2.7.1.1) ast (~> 2.4.0) postrank-uri (1.0.24) addressable (>= 2.4.0) @@ -450,7 +450,7 @@ GEM rspec-expectations (3.9.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) - rspec-graphql_matchers (1.2) + rspec-graphql_matchers (1.2.1) graphql (>= 1.8, < 2.0) rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) @@ -473,7 +473,7 @@ GEM unicode-display_width (>= 1.4.0, < 1.7) rubocop-performance (1.5.2) rubocop (>= 0.71.0) - rubocop-rails (2.5.0) + rubocop-rails (2.5.2) activesupport rack (>= 1.1) rubocop (>= 0.72.0) @@ -515,9 +515,9 @@ GEM sprockets (>= 3.0.0) string_pattern (2.2.2) regexp_parser (~> 1.3, >= 1.3.0) - strip_attributes (1.9.2) + strip_attributes (1.11.0) activemodel (>= 3.0, < 7.0) - strong_migrations (0.6.2) + strong_migrations (0.6.4) activerecord (>= 5) sxp (1.1.0) rdf (~> 3.1) @@ -535,11 +535,11 @@ GEM rack (>= 1.3, < 3) rack-accept (~> 0.4) tilt (>= 1.4, < 3) - tzinfo (1.2.6) + tzinfo (1.2.7) thread_safe (~> 0.1) unf (0.1.4) unf_ext - unf_ext (0.0.7.6) + unf_ext (0.0.7.7) unicode-display_width (1.6.1) unicode_utils (1.4.0) uniform_notifier (1.13.0) @@ -603,7 +603,7 @@ DEPENDENCIES gender_detector (~> 0.1.2) git (~> 1.5) google-protobuf (= 3.10.0.rc.1) - graphql (~> 1.9, >= 1.9.16) + graphql (~> 1.9.16) graphql-batch (~> 0.4.1) graphql-cache (~> 0.6.0) graphql-errors (~> 0.4.0) @@ -611,7 +611,7 @@ DEPENDENCIES iso8601 (~> 0.9.0) jsonlint (~> 0.3.0) jwt - kaminari (~> 1.0, >= 1.0.1) + kaminari (~> 1.2) kt-paperclip (~> 6.2, >= 6.2.2) lhm (~> 2.2) listen (>= 3.0.5, < 3.2) diff --git a/spec/requests/media_spec.rb b/spec/requests/media_spec.rb index ca294ab98..1c95c4fac 100644 --- a/spec/requests/media_spec.rb +++ b/spec/requests/media_spec.rb @@ -11,22 +11,18 @@ let(:media_type) { "application/xml" } let(:url) { "https://example.org" } - # describe 'GET /dois/DOI/media' do - # it 'returns media' do - # get "/dois/#{doi.doi}/media", nil, headers - - # expect(json).not_to be_empty - # expect(json['data'].size).to eq(6) - # result = json['data'].first - # expect(result.dig("attributes", "mediaType")).to eq("application/json") - # end - - # it 'returns status code 200' do - # get "/dois/#{doi.doi}/media", nil, headers - - # expect(last_response.status).to eq(200) - # end - # end + describe 'GET /dois/DOI/media' do + it 'returns media' do + get "/dois/#{doi.doi}/media", nil, headers + + puts last_response.body + expect(last_response.status).to eq(200) + expect(json).not_to be_empty + expect(json['data'].size).to eq(6) + result = json['data'].first + expect(result.dig("attributes", "mediaType")).to eq("application/json") + end + end describe 'GET /media query by doi not found' do it 'returns media' do