From 8faa712e074d9255e2e1bcc0003ce69725fd8870 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 27 Jun 2019 22:23:47 +1200 Subject: [PATCH] be_success -> be_successfull fixes a deprecation warning --- .python-version | 1 + app/controllers/crops_controller.rb | 3 ++- spec/controllers/admin_controller_spec.rb | 2 +- spec/controllers/charts/crops_controller_spec.rb | 6 +++--- spec/controllers/comments_controller_spec.rb | 10 +++++----- spec/controllers/crops_controller_spec.rb | 10 +++++----- spec/controllers/member_controller_spec.rb | 6 +++--- spec/controllers/posts_controller_spec.rb | 4 ++-- spec/controllers/robots_controller_spec.rb | 8 ++++---- spec/controllers/seeds_controller_spec.rb | 2 +- 10 files changed, 27 insertions(+), 25 deletions(-) create mode 100644 .python-version diff --git a/.python-version b/.python-version new file mode 100644 index 000000000..47b6be3fa --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.7.2 \ No newline at end of file diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index c4e2fcdfb..89e45a163 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -197,7 +197,8 @@ class CropsController < ApplicationController def crops q = Crop.approved.includes(:scientific_names, plantings: :photos) q = q.popular unless @sort == 'alpha' - q.order("LOWER(crops.name)").includes(:photos).paginate(page: params[:page]) + q.order(Arel.sql("LOWER(crops.name)")) + .includes(:photos).paginate(page: params[:page]) end def requested_crops diff --git a/spec/controllers/admin_controller_spec.rb b/spec/controllers/admin_controller_spec.rb index ad6cba550..7f0e56206 100644 --- a/spec/controllers/admin_controller_spec.rb +++ b/spec/controllers/admin_controller_spec.rb @@ -7,7 +7,7 @@ describe AdminController do before { get :newsletter } describe 'fetches the admin newsletter page' do - it { expect(response).to be_success } + it { expect(response).to be_successful } it { expect(response).to render_template("admin/newsletter") } end diff --git a/spec/controllers/charts/crops_controller_spec.rb b/spec/controllers/charts/crops_controller_spec.rb index 120179c78..3a6a40bb4 100644 --- a/spec/controllers/charts/crops_controller_spec.rb +++ b/spec/controllers/charts/crops_controller_spec.rb @@ -7,19 +7,19 @@ describe Charts::CropsController do describe 'sunniness' do before { get :sunniness, params: { crop_slug: crop.to_param } } - it { expect(response).to be_success } + it { expect(response).to be_successful } end describe 'planted_from' do before { get :planted_from, params: { crop_slug: crop.to_param } } - it { expect(response).to be_success } + it { expect(response).to be_successful } end describe 'harvested_for' do before { get :harvested_for, params: { crop_slug: crop.to_param } } - it { expect(response).to be_success } + it { expect(response).to be_successful } end end end diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index ed5b8ad86..741b19ff3 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -22,7 +22,7 @@ describe CommentsController do describe "returns an RSS feed" do before { get :index, format: "rss" } - it { is_expected.to be_success } + it { is_expected.to be_successful } it { is_expected.to render_template("comments/index") } it { expect(response.content_type).to eq("application/rss+xml") } it { expect(assigns(:comments)).to eq([last_comment, first_comment]) } @@ -48,7 +48,7 @@ describe CommentsController do it "dies if no post specified" do get :new - expect(response).not_to be_success + expect(response).not_to be_successful end end @@ -69,7 +69,7 @@ describe CommentsController do describe "not my comment" do let(:comment) { FactoryBot.create :comment, post: post } - it { expect(response).not_to be_success } + it { expect(response).not_to be_successful } end end @@ -87,7 +87,7 @@ describe CommentsController do describe "not my comment" do let(:comment) { FactoryBot.create :comment } - it { expect(response).not_to be_success } + it { expect(response).not_to be_successful } end describe "attempting to change post_id" do @@ -117,7 +117,7 @@ describe CommentsController do describe "not my comment" do let(:comment) { FactoryBot.create :comment } - it { expect(response).not_to be_success } + it { expect(response).not_to be_successful } end end end diff --git a/spec/controllers/crops_controller_spec.rb b/spec/controllers/crops_controller_spec.rb index 34fe59eec..7efc1a9ba 100644 --- a/spec/controllers/crops_controller_spec.rb +++ b/spec/controllers/crops_controller_spec.rb @@ -12,14 +12,14 @@ describe CropsController do context 'anonymous' do before { get :wrangle } - it { is_expected.not_to be_success } + it { is_expected.not_to be_successful } end context 'wrangler' do include_context 'login as wrangler' before { get :wrangle } - it { is_expected.to be_success } + it { is_expected.to be_successful } it { is_expected.to render_template("crops/wrangle") } it { expect(assigns[:crop_wranglers]).to eq(Role.crop_wranglers) } end @@ -32,7 +32,7 @@ describe CropsController do include_context 'login as wrangler' before { get :hierarchy } - it { is_expected.to be_success } + it { is_expected.to be_successful } it { is_expected.to render_template("crops/hierarchy") } end end @@ -46,7 +46,7 @@ describe CropsController do describe 'search form page' do before { get :search } - it { is_expected.to be_success } + it { is_expected.to be_successful } it { is_expected.to render_template("crops/search") } end @@ -62,7 +62,7 @@ describe CropsController do describe "returns an RSS feed" do before { get :index, format: "rss" } - it { is_expected.to be_success } + it { is_expected.to be_successful } it { is_expected.to render_template("crops/index") } it { expect(response.content_type).to eq("application/rss+xml") } end diff --git a/spec/controllers/member_controller_spec.rb b/spec/controllers/member_controller_spec.rb index f6d01207f..173b0ff0e 100644 --- a/spec/controllers/member_controller_spec.rb +++ b/spec/controllers/member_controller_spec.rb @@ -18,14 +18,14 @@ describe MembersController do describe "GET JSON index" do it "provides JSON for members" do get :index, format: 'json' - response.should be_success + response.should be_successful end end describe "GET show" do it "provides JSON for member profile" do get :show, params: { slug: @member.to_param }, format: 'json' - response.should be_success + response.should be_successful end it "assigns @posts with the member's posts" do @@ -59,7 +59,7 @@ describe MembersController do describe "returns an RSS feed" do before { get :show, params: { slug: @member.to_param }, format: "rss" } - it { response.should be_success } + it { response.should be_successful } it { response.should render_template("members/show") } it { response.content_type.should eq("application/rss+xml") } end diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb index e490d2ff5..0842e4a5b 100644 --- a/spec/controllers/posts_controller_spec.rb +++ b/spec/controllers/posts_controller_spec.rb @@ -27,7 +27,7 @@ describe PostsController do describe "GET RSS feed" do it "returns an RSS feed" do get :index, format: "rss" - expect(response).to be_success + expect(response).to be_successful expect(response).to render_template("posts/index") expect(response.content_type).to eq("application/rss+xml") end @@ -37,7 +37,7 @@ describe PostsController do it "returns an RSS feed" do post = Post.create! valid_attributes get :show, format: "rss", params: { id: post.slug } - expect(response).to be_success + expect(response).to be_successful expect(response).to render_template("posts/show") expect(response.content_type).to eq("application/rss+xml") end diff --git a/spec/controllers/robots_controller_spec.rb b/spec/controllers/robots_controller_spec.rb index 15ab05d82..b45a8b235 100644 --- a/spec/controllers/robots_controller_spec.rb +++ b/spec/controllers/robots_controller_spec.rb @@ -15,7 +15,7 @@ describe RobotsController do it 'loads the staging robots.txt file' do get :robots - expect(response).to be_success + expect(response).to be_successful expect(response.body).to eq(File.read(staging_filename)) end end @@ -26,7 +26,7 @@ describe RobotsController do it 'loads the production robots.txt file' do get :robots - expect(response).to be_success + expect(response).to be_successful expect(response.body).to eq(File.read(production_filename)) end end @@ -37,7 +37,7 @@ describe RobotsController do it 'loads the production robots.txt file' do get :robots - expect(response).to be_success + expect(response).to be_successful expect(response.body).to eq(File.read(production_filename)) end end @@ -48,7 +48,7 @@ describe RobotsController do it 'loads the production robots.txt file' do get :robots - expect(response).to be_success + expect(response).to be_successful expect(response.body).to eq(File.read(production_filename)) end end diff --git a/spec/controllers/seeds_controller_spec.rb b/spec/controllers/seeds_controller_spec.rb index eefaa1c36..1c6e89bb3 100644 --- a/spec/controllers/seeds_controller_spec.rb +++ b/spec/controllers/seeds_controller_spec.rb @@ -16,7 +16,7 @@ describe SeedsController do describe 'GET new' do before { sign_in owner } - it { expect(response).to be_success } + it { expect(response).to be_successful } context 'no parent planting' do before { get :new }