diff --git a/spec/controllers/admin_public_body_categories_controller_spec.rb b/spec/controllers/admin_public_body_categories_controller_spec.rb index 93304fe731d..6cf6d966b69 100644 --- a/spec/controllers/admin_public_body_categories_controller_spec.rb +++ b/spec/controllers/admin_public_body_categories_controller_spec.rb @@ -265,8 +265,7 @@ it 'builds new translations if the body does not already have a translation in the specified locale' do get :edit, params: { id: @category.id } - expect(assigns[:public_body_category]. - translations.map(&:locale)). + expect(assigns[:public_body_category].translations.map(&:locale)). to include(:fr) end @@ -685,9 +684,8 @@ id: @category.id, public_body_category: @params } - expect( - assigns(:public_body_category).title(:en) - ).to eq('Need a description') + expect(assigns(:public_body_category).title(:en)). + to eq('Need a description') end it 'is rebuilt with the alternative locale translation' do @@ -697,9 +695,8 @@ } AlaveteliLocalization.with_locale(:es) do - expect( - assigns(:public_body_category).title - ).to eq('Mi Nuevo Category') + expect(assigns(:public_body_category).title). + to eq('Mi Nuevo Category') end end diff --git a/spec/controllers/admin_public_body_controller_spec.rb b/spec/controllers/admin_public_body_controller_spec.rb index fa3ca9988ee..72d01f5855e 100644 --- a/spec/controllers/admin_public_body_controller_spec.rb +++ b/spec/controllers/admin_public_body_controller_spec.rb @@ -312,9 +312,8 @@ end it 'should mark the change request as closed' do - expect( - PublicBodyChangeRequest.find(@change_request.id).is_open - ).to be false + expect(PublicBodyChangeRequest.find(@change_request.id).is_open). + to be false end end @@ -355,8 +354,7 @@ get :edit, params: { id: 3, locale: :en } # When editing a body, the controller returns all available translations - expect(assigns[:public_body]. - find_translation_by_locale("es").name). + expect(assigns[:public_body].find_translation_by_locale("es").name). to eq('El Department for Humpadinking') expect(assigns[:public_body].name).to eq('Department for Humpadinking') expect(response).to render_template('edit') @@ -379,18 +377,15 @@ id: change_request.public_body_id, change_request_id: change_request.id } - expect( - assigns[:public_body].request_email - ).to eq(@change_request.public_body_email) - expect( - assigns[:public_body].last_edit_comment - ).to match('Notes: Please') + expect(assigns[:public_body].request_email). + to eq(@change_request.public_body_email) + expect(assigns[:public_body].last_edit_comment). + to match('Notes: Please') end it 'should assign a default response text to the view' do - expect( - assigns[:change_request_user_response] - ).to match("Thanks for your suggestion to update the email address") + expect(assigns[:change_request_user_response]). + to match("Thanks for your suggestion to update the email address") end end @@ -657,9 +652,8 @@ end it 'should mark the change request as closed' do - expect( - PublicBodyChangeRequest.find(@change_request.id).is_open - ).to be false + expect(PublicBodyChangeRequest.find(@change_request.id).is_open). + to be false end end diff --git a/spec/controllers/admin_public_body_headings_controller_spec.rb b/spec/controllers/admin_public_body_headings_controller_spec.rb index c2f6703b9bb..bbcde631bc2 100644 --- a/spec/controllers/admin_public_body_headings_controller_spec.rb +++ b/spec/controllers/admin_public_body_headings_controller_spec.rb @@ -183,8 +183,7 @@ it 'builds new translations if the body does not already have a translation in the specified locale' do get :edit, params: { id: @heading.id } - expect(assigns[:public_body_heading]. - translations.map(&:locale)). + expect(assigns[:public_body_heading].translations.map(&:locale)). to include(:fr) end diff --git a/spec/controllers/alaveteli_pro/base_controller_spec.rb b/spec/controllers/alaveteli_pro/base_controller_spec.rb index 467435e20c6..3e021111c8a 100644 --- a/spec/controllers/alaveteli_pro/base_controller_spec.rb +++ b/spec/controllers/alaveteli_pro/base_controller_spec.rb @@ -21,9 +21,8 @@ def index context "when the user is not logged in" do it "redirects to the signin path" do get :index - expect( - @response.redirect_url - ).to match(/http:\/\/test\.host\/profile\/sign_in/) + expect(@response.redirect_url). + to match(/http:\/\/test\.host\/profile\/sign_in/) end end diff --git a/spec/controllers/alaveteli_pro/info_request_batches_controller_spec.rb b/spec/controllers/alaveteli_pro/info_request_batches_controller_spec.rb index a0c92103cfa..6d84b9b7d01 100644 --- a/spec/controllers/alaveteli_pro/info_request_batches_controller_spec.rb +++ b/spec/controllers/alaveteli_pro/info_request_batches_controller_spec.rb @@ -12,8 +12,7 @@ it "raises ActiveRecord::RecordNotFound" do with_feature_enabled(:alaveteli_pro) do params[:draft_id] = AlaveteliPro::DraftInfoRequestBatch. - maximum(:id). - next + maximum(:id).next expect { action }.to raise_error(ActiveRecord::RecordNotFound) end end @@ -183,9 +182,8 @@ with_feature_enabled(:alaveteli_pro) do action expect(assigns[:info_request_batch].errors).to be_empty - expect( - assigns[:example_info_request].errors[:outgoing_messages] - ).to be_empty + expect(assigns[:example_info_request].errors[:outgoing_messages]). + to be_empty expect(assigns[:example_info_request].errors[:title]).not_to be_empty expect(assigns[:outgoing_message].errors[:body]).not_to be_empty end @@ -220,9 +218,9 @@ it "destroys the draft" do with_feature_enabled(:alaveteli_pro) do title = draft.title - expect { action }.to change { - AlaveteliPro::DraftInfoRequestBatch.count - }.by(-1) + expect { action }. + to change { AlaveteliPro::DraftInfoRequestBatch.count }. + by(-1) expect(AlaveteliPro::DraftInfoRequestBatch.where(title: title)) end end @@ -231,9 +229,8 @@ with_feature_enabled(:alaveteli_pro) do action new_batch = InfoRequestBatch.order(created_at: :desc).first - expect(response).to redirect_to( - show_alaveteli_pro_batch_request_path(new_batch.id) - ) + expect(response). + to redirect_to(show_alaveteli_pro_batch_request_path(new_batch.id)) end end end @@ -300,9 +297,8 @@ with_feature_enabled(:alaveteli_pro) do action expect(assigns[:info_request_batch].errors).to be_empty - expect( - assigns[:example_info_request].errors[:outgoing_messages] - ).to be_empty + expect(assigns[:example_info_request].errors[:outgoing_messages]). + to be_empty expect(assigns[:example_info_request].errors[:title]).not_to be_empty expect(assigns[:outgoing_message].errors[:body]).not_to be_empty end diff --git a/spec/controllers/alaveteli_pro/info_requests_controller_spec.rb b/spec/controllers/alaveteli_pro/info_requests_controller_spec.rb index 1f126233e89..4bb0401b02f 100644 --- a/spec/controllers/alaveteli_pro/info_requests_controller_spec.rb +++ b/spec/controllers/alaveteli_pro/info_requests_controller_spec.rb @@ -31,10 +31,9 @@ it "assigns the user's request summaries" do get :index expect(assigns[:request_summaries].size).to eq 2 - expect(assigns[:request_summaries]). - to match_array [ - info_request.request_summary, foo_request.request_summary - ] + expect(assigns[:request_summaries]).to match_array [ + info_request.request_summary, foo_request.request_summary + ] end end diff --git a/spec/controllers/api_controller_spec.rb b/spec/controllers/api_controller_spec.rb index ccf70eff69d..d0ed0643f96 100644 --- a/spec/controllers/api_controller_spec.rb +++ b/spec/controllers/api_controller_spec.rb @@ -86,24 +86,20 @@ def _create_request new_request = InfoRequest.find(response_body['id']) expect(new_request.user_id).to be_nil - expect( - new_request.external_user_name - ).to eq(request_data['external_user_name']) + expect(new_request.external_user_name). + to eq(request_data['external_user_name']) expect(new_request.external_url).to eq(request_data['external_url']) expect(new_request.title).to eq(request_data['title']) - expect( - new_request.last_event_forming_initial_request.outgoing_message.body - ).to eq(request_data['body'].strip) + last_event = new_request.last_event_forming_initial_request + expect(last_event.outgoing_message.body).to eq(request_data['body'].strip) - expect( - new_request.public_body_id - ).to eq(public_bodies(:geraldine_public_body).id) + expect(new_request.public_body_id). + to eq(public_bodies(:geraldine_public_body).id) expect(new_request.info_request_events.size).to eq(1) expect(new_request.info_request_events[0].event_type).to eq('sent') - expect( - new_request.info_request_events[0].calculated_state - ).to eq('waiting_response') + expect(new_request.info_request_events[0].calculated_state). + to eq('waiting_response') end end @@ -144,9 +140,8 @@ def _create_request incoming_message = incoming_messages[0] expect(incoming_message.sent_at).to eq(Time.iso8601(sent_at)) - expect( - incoming_message.get_main_body_text_folded - ).to be_equal_modulo_whitespace_to(response_body) + expect(incoming_message.get_main_body_text_folded). + to be_equal_modulo_whitespace_to(response_body) end it 'should add a followup to a request' do @@ -337,9 +332,8 @@ def _create_request }.to_json } expect(response.status).to eq(404) - expect( - ActiveSupport::JSON.decode(response.body)['errors'] - ).to eq(['Could not find request 123459876']) + expect(ActiveSupport::JSON.decode(response.body)['errors']). + to eq(['Could not find request 123459876']) end it 'should return a JSON 403 error if we try to add correspondence to a request we don\'t own' do @@ -361,9 +355,8 @@ def _create_request }.to_json } expect(response.status).to eq(403) - expect( - ActiveSupport::JSON.decode(response.body)['errors'] - ).to eq(["Request #{request_id} cannot be updated using the API"]) + expect(ActiveSupport::JSON.decode(response.body)['errors']). + to eq(["Request #{request_id} cannot be updated using the API"]) end it 'should not allow files to be attached to a followup' do @@ -426,9 +419,8 @@ def _create_request incoming_message = incoming_messages[0] expect(incoming_message.sent_at).to eq(Time.iso8601(sent_at)) - expect( - incoming_message.get_main_body_text_folded - ).to be_equal_modulo_whitespace_to(response_body) + expect(incoming_message.get_main_body_text_folded). + to be_equal_modulo_whitespace_to(response_body) # Get the attachment attachments = incoming_message.get_attachments_for_display @@ -486,9 +478,8 @@ def _create_request # Check that the error has been raised... expect(response.status).to eq(500) - expect( - ActiveSupport::JSON.decode(response.body)['errors'] - ).to eq(["'random_string' is not a valid request state"]) + expect(ActiveSupport::JSON.decode(response.body)['errors']). + to eq(["'random_string' is not a valid request state"]) # ..and that the status hasn't been updated request = InfoRequest.find_by_id(request_id) @@ -508,9 +499,8 @@ def _create_request } expect(response.status).to eq(404) - expect( - ActiveSupport::JSON.decode(response.body)['errors'] - ).to eq(['Could not find request 123459876']) + expect(ActiveSupport::JSON.decode(response.body)['errors']). + to eq(['Could not find request 123459876']) end it 'should return a JSON 403 error if we try to add correspondence to a request we don\'t own' do @@ -522,9 +512,8 @@ def _create_request } expect(response.status).to eq(403) - expect( - ActiveSupport::JSON.decode(response.body)['errors'] - ).to eq(["Request #{request_id} cannot be updated using the API"]) + expect(ActiveSupport::JSON.decode(response.body)['errors']). + to eq(["Request #{request_id} cannot be updated using the API"]) end end diff --git a/spec/controllers/followups_controller_spec.rb b/spec/controllers/followups_controller_spec.rb index 88834049c25..3514d60f6ad 100644 --- a/spec/controllers/followups_controller_spec.rb +++ b/spec/controllers/followups_controller_spec.rb @@ -542,9 +542,8 @@ def send_request request_id: request.id, incoming_message_id: message_id } - expect(flash[:notice]).to eq( - 'Your follow up message has been sent on its way.' - ) + expect(flash[:notice]). + to eq('Your follow up message has been sent on its way.') end it "displays an error if the request has been closed to new responses" do diff --git a/spec/controllers/general_controller_spec.rb b/spec/controllers/general_controller_spec.rb index c5150fb90bc..8fe56c8d803 100644 --- a/spec/controllers/general_controller_spec.rb +++ b/spec/controllers/general_controller_spec.rb @@ -228,9 +228,8 @@ expect(response).to render_template('search') expect(assigns[:xapian_requests].matches_estimated).to eq(1) expect(assigns[:xapian_requests].results.size).to eq(1) - expect(assigns[:xapian_requests].results[0][:model]).to eq( - info_request_events(:useless_outgoing_message_event) - ) + expect(assigns[:xapian_requests].results[0][:model]). + to eq(info_request_events(:useless_outgoing_message_event)) assigns[:xapian_requests].words_to_highlight == %w[fancy dog] end @@ -304,9 +303,8 @@ get :search, params: { combined: "quango/bodies" } expect(assigns[:xapian_requests]).to eq(nil) expect(assigns[:xapian_users]).to eq(nil) - expect(assigns[:xapian_bodies].results.map { |x| x[:model] }).to eq( - [public_bodies(:geraldine_public_body)] - ) + expect(assigns[:xapian_bodies].results.map { |x| x[:model] }). + to eq([public_bodies(:geraldine_public_body)]) end it 'should prioritise direct matches of public body names' do diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb index c1d2c6839ca..843268d1c2b 100644 --- a/spec/controllers/help_controller_spec.rb +++ b/spec/controllers/help_controller_spec.rb @@ -72,8 +72,7 @@ before do # Prepend our fixture templates - fixture_theme_path = File.join( - Rails.root, + fixture_theme_path = Rails.root.join( 'spec', 'fixtures', 'theme_views', diff --git a/spec/controllers/public_body_change_requests_controller_spec.rb b/spec/controllers/public_body_change_requests_controller_spec.rb index ba827abe8f0..def54f74fe0 100644 --- a/spec/controllers/public_body_change_requests_controller_spec.rb +++ b/spec/controllers/public_body_change_requests_controller_spec.rb @@ -51,10 +51,13 @@ expect(mail.body).to include('new_body@example.com') expect(mail.body).to include('New Body') expect(mail.body).to include("Please") - expect(mail.body).to include("http://test.host/admin/bodies/" \ - "new?change_request_id=#{change_request_id}") - expect(mail.body).to include("http://test.host/admin/change_requests/" \ - "#{change_request_id}/edit") + expect(mail.body).to include( + "http://test.host/admin/bodies/new?change_request_id=" \ + "#{change_request_id}" + ) + expect(mail.body).to include( + "http://test.host/admin/change_requests/#{change_request_id}/edit" + ) end it 'sets render_recaptcha to true if there is no logged in user' do @@ -100,7 +103,7 @@ it 'has rudimentary spam protection' do spam_request_params = @change_request_params.merge( - { comment: 'I AM A SPAMBOT' } + comment: 'I AM A SPAMBOT' ) post :create, params: { diff --git a/spec/controllers/public_body_controller_spec.rb b/spec/controllers/public_body_controller_spec.rb index 555146810fc..0619351c4f4 100644 --- a/spec/controllers/public_body_controller_spec.rb +++ b/spec/controllers/public_body_controller_spec.rb @@ -155,7 +155,8 @@ def make_single_language_example(locale) it "if fallback is requested, should list all bodies from default locale, even when there are no translations for selected locale" do allow(AlaveteliConfiguration). - to receive(:public_body_list_fallback_to_default_locale).and_return(true) + to receive(:public_body_list_fallback_to_default_locale). + and_return(true) @english_only = make_single_language_example :en get :list, params: { locale: 'es' } expect(assigns[:public_bodies].include?(@english_only)).to eq(true) @@ -163,7 +164,8 @@ def make_single_language_example(locale) it 'if fallback is requested, should still list public bodies only with translations in the current locale' do allow(AlaveteliConfiguration). - to receive(:public_body_list_fallback_to_default_locale).and_return(true) + to receive(:public_body_list_fallback_to_default_locale). + and_return(true) @spanish_only = make_single_language_example :es get :list, params: { locale: 'es' } expect(assigns[:public_bodies].include?(@spanish_only)).to eq(true) @@ -171,7 +173,8 @@ def make_single_language_example(locale) it "if fallback is requested, make sure that there are no duplicates listed" do allow(AlaveteliConfiguration). - to receive(:public_body_list_fallback_to_default_locale).and_return(true) + to receive(:public_body_list_fallback_to_default_locale). + and_return(true) get :list, params: { locale: 'es' } pb_ids = assigns[:public_bodies].map(&:id) unique_pb_ids = pb_ids.uniq @@ -202,7 +205,8 @@ def make_single_language_example(locale) # Public Body Name # ... eo extract all of those, and check that they are ordered: allow(AlaveteliConfiguration). - to receive(:public_body_list_fallback_to_default_locale).and_return(true) + to receive(:public_body_list_fallback_to_default_locale). + and_return(true) get :list, params: { locale: 'es' } parsed = Nokogiri::HTML(response.body) public_body_names = parsed.xpath '//span[@class="head"]/a/text()' diff --git a/spec/controllers/request_controller_spec.rb b/spec/controllers/request_controller_spec.rb index 7b2c3ed9182..2ccc60ad34b 100644 --- a/spec/controllers/request_controller_spec.rb +++ b/spec/controllers/request_controller_spec.rb @@ -137,8 +137,8 @@ with_feature_enabled(:alaveteli_pro) do sign_in pro_user get :show, params: { url_title: info_request.url_title } - expect(response).to redirect_to show_alaveteli_pro_request_path( - url_title: info_request.url_title + expect(response).to redirect_to( + show_alaveteli_pro_request_path(url_title: info_request.url_title) ) end end @@ -458,8 +458,8 @@ def make_request info_request = FactoryBot.create(:info_request) expected_transitions = { pending: { - "waiting_response" => "No response has been received" \ - " (maybe there's just an acknowledgement)", + "waiting_response" => "No response has been " \ + "received (maybe there's just an acknowledgement)", "waiting_clarification" => "Clarification has been " \ "requested", "gone_postal" => "A response will be sent by postal " \ @@ -648,9 +648,8 @@ def expect_hidden(hidden_template) expect(response).to render_template('select_authority') assigns[:xapian_requests].results.size == 1 - expect( - assigns[:xapian_requests].results[0][:model].name - ).to eq(public_bodies(:geraldine_public_body).name) + expect(assigns[:xapian_requests].results[0][:model].name). + to eq(public_bodies(:geraldine_public_body).name) end it "remembers the search params" do @@ -891,12 +890,10 @@ def send_request submitted_new_request: 1, preview: 1 } - expect( - assigns[:info_request].errors.full_messages - ).not_to include('Outgoing messages is invalid') - expect( - assigns[:outgoing_message].errors.full_messages - ).to include('Body Please enter your letter requesting information') + expect(assigns[:info_request].errors.full_messages). + not_to include('Outgoing messages is invalid') + expect(assigns[:outgoing_message].errors.full_messages). + to include('Body Please enter your letter requesting information') end it "should give an error and render 'new' template when a summary isn't given" do @@ -1018,9 +1015,8 @@ def send_request ir = ir_array[0] expect(ir.outgoing_messages.size).to eq(1) om = ir.outgoing_messages[0] - expect(om.body).to eq( - "This is a silly letter. It is too short to be interesting." - ) + expect(om.body). + to eq("This is a silly letter. It is too short to be interesting.") deliveries = ActionMailer::Base.deliveries expect(deliveries.size).to eq(1) @@ -1126,10 +1122,9 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response). - to redirect_to show_request_url( - url_title: 'what_is_the_answer_to_the_ultima' - ) + expect(response).to redirect_to( + show_request_url(url_title: 'what_is_the_answer_to_the_ultima') + ) post :new, params: { info_request: { @@ -1143,8 +1138,8 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response).to redirect_to show_request_url( - url_title: 'why_did_the_chicken_cross_the_ro' + expect(response).to redirect_to( + show_request_url(url_title: 'why_did_the_chicken_cross_the_ro') ) post :new, params: { @@ -1182,8 +1177,8 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response).to redirect_to show_request_url( - url_title: 'what_is_the_answer_to_the_ultima' + expect(response).to redirect_to( + show_request_url(url_title: 'what_is_the_answer_to_the_ultima') ) post :new, params: { @@ -1198,8 +1193,8 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response).to redirect_to show_request_url( - url_title: 'why_did_the_chicken_cross_the_ro' + expect(response).to redirect_to( + show_request_url(url_title: 'why_did_the_chicken_cross_the_ro') ) post :new, params: { @@ -1215,8 +1210,8 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response).to redirect_to show_request_url( - url_title: 'whats_black_and_white_and_red_al' + expect(response).to redirect_to( + show_request_url(url_title: 'whats_black_and_white_and_red_al') ) end @@ -1358,8 +1353,8 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response).to redirect_to show_request_path( - url_title: 'some_request_text' + expect(response).to redirect_to( + show_request_path(url_title: 'some_request_text') ) end @@ -1509,8 +1504,8 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response).to redirect_to show_request_path( - url_title: 'hd_watch_jason_bourne_online_fre' + expect(response).to redirect_to( + show_request_path(url_title: 'hd_watch_jason_bourne_online_fre') ) end @@ -1555,8 +1550,8 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response).to redirect_to show_request_path( - url_title: 'hd_watch_jason_bourne_online_fre' + expect(response).to redirect_to( + show_request_path(url_title: 'hd_watch_jason_bourne_online_fre') ) end @@ -1656,8 +1651,8 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response).to redirect_to show_request_path( - url_title: 'some_request_content' + expect(response).to redirect_to( + show_request_path(url_title: 'some_request_content') ) end @@ -1703,8 +1698,8 @@ def send_request submitted_new_request: 1, preview: 0 } - expect(response).to redirect_to show_request_path( - url_title: 'some_request_content' + expect(response).to redirect_to( + show_request_path(url_title: 'some_request_content') ) end @@ -1891,7 +1886,7 @@ def send_request end # How do I test a file upload in rails? - # http://stackoverflow.com/questions/1178587/how-do-i-test-a-file-upload-in-rails # rubocop:disable Layout/LineLength + # http://stackoverflow.com/questions/1178587/how-do-i-test-a-file-upload-in-rails it "should let the authority upload a file" do @ir = info_requests(:fancy_dog_request) incoming_before = @ir.incoming_messages.count @@ -2053,7 +2048,8 @@ def send_request context "when annotations are disabled" do before do - allow(controller).to receive(:feature_enabled?). + allow(controller). + to receive(:feature_enabled?). with(:annotations). and_return(false) end diff --git a/spec/controllers/track_controller_spec.rb b/spec/controllers/track_controller_spec.rb index 7bfb31d35d4..f2a57c3f6d6 100644 --- a/spec/controllers/track_controller_spec.rb +++ b/spec/controllers/track_controller_spec.rb @@ -53,7 +53,8 @@ it "should save a request track and redirect if you are logged in" do sign_in user - allow(TrackThing).to receive(:create_track_for_request). + allow(TrackThing). + to receive(:create_track_for_request). and_return(track_thing) expect(track_thing).to receive(:save).and_call_original get :track_request, params: { @@ -176,7 +177,8 @@ it "should save a search track and redirect to the right place" do sign_in user - allow(TrackThing).to receive(:create_track_for_search_query). + allow(TrackThing). + to receive(:create_track_for_search_query). and_return(track_thing) expect(track_thing).to receive(:save).and_call_original get :track_search_query, params: { query_array: "bob variety:sent", @@ -229,7 +231,8 @@ long_track = TrackThing.new(track_type: 'search_query', track_query: "lorem ipsum " * 42) sign_in user - allow(TrackThing).to receive(:create_track_for_search_query). + allow(TrackThing). + to receive(:create_track_for_search_query). and_return(long_track) get :track_search_query, params: { query_array: "bob variety:sent", @@ -256,7 +259,8 @@ sign_in user track_thing = TrackThing.new(track_type: 'public_body_updates', public_body: public_body) - allow(TrackThing).to receive(:create_track_for_public_body). + allow(TrackThing). + to receive(:create_track_for_public_body). and_return(track_thing) expect(track_thing).to receive(:save).and_call_original get :track_public_body, params: { @@ -272,7 +276,8 @@ long_track = TrackThing.new(track_type: 'public_body_updates', public_body: public_body, track_query: "lorem ipsum " * 42) - allow(TrackThing).to receive(:create_track_for_public_body). + allow(TrackThing). + to receive(:create_track_for_public_body). and_return(long_track) get :track_public_body, params: { url_name: public_body.url_name, @@ -326,7 +331,7 @@ ) allow(TrackThing). to receive(:create_track_for_user). - and_return(track_thing) + and_return(track_thing) expect(track_thing).to receive(:save).and_call_original get :track_user, params: { url_name: target_user.url_name, feed: 'track' } diff --git a/spec/controllers/user_profile/about_me_controller_spec.rb b/spec/controllers/user_profile/about_me_controller_spec.rb index 5cf32a4705a..c767f1b7d07 100644 --- a/spec/controllers/user_profile/about_me_controller_spec.rb +++ b/spec/controllers/user_profile/about_me_controller_spec.rb @@ -368,9 +368,8 @@ about_me: '[HD] Watch Jason Bourne Online free MOVIE Full-HD' } } - expect( - user.reload.about_me - ).to eq('[HD] Watch Jason Bourne Online free MOVIE Full-HD') + expect(user.reload.about_me). + to eq('[HD] Watch Jason Bourne Online free MOVIE Full-HD') end end