diff --git a/spec/controllers/ajax/answer_controller_spec.rb b/spec/controllers/ajax/answer_controller_spec.rb index bdc6cef4..b234a41b 100644 --- a/spec/controllers/ajax/answer_controller_spec.rb +++ b/spec/controllers/ajax/answer_controller_spec.rb @@ -4,7 +4,6 @@ require "rails_helper" describe Ajax::AnswerController, :ajax_controller, type: :controller do - let(:user) { FactoryBot.create(:user) } let(:question) { FactoryBot.create(:question, user: FactoryBot.build(:user, privacy_allow_stranger_answers: asker_allows_strangers)) } let(:asker_allows_strangers) { true } diff --git a/spec/controllers/ajax/comment_controller_spec.rb b/spec/controllers/ajax/comment_controller_spec.rb index c071b03f..d1e1b0be 100644 --- a/spec/controllers/ajax/comment_controller_spec.rb +++ b/spec/controllers/ajax/comment_controller_spec.rb @@ -4,7 +4,6 @@ require "rails_helper" describe Ajax::CommentController, :ajax_controller, type: :controller do - let(:user) { FactoryBot.create(:user) } let(:answer) { FactoryBot.create(:answer, user: FactoryBot.create(:user)) } describe "#create" do diff --git a/spec/controllers/ajax/friend_controller_spec.rb b/spec/controllers/ajax/friend_controller_spec.rb index 13b86ae1..89b846cf 100644 --- a/spec/controllers/ajax/friend_controller_spec.rb +++ b/spec/controllers/ajax/friend_controller_spec.rb @@ -3,8 +3,6 @@ require "rails_helper" describe Ajax::FriendController, :ajax_controller, type: :controller do - let(:user) { FactoryBot.create(:user) } - describe "#create" do let(:params) do { diff --git a/spec/controllers/ajax/inbox_controller_spec.rb b/spec/controllers/ajax/inbox_controller_spec.rb index 07ca219a..3d99ffe7 100644 --- a/spec/controllers/ajax/inbox_controller_spec.rb +++ b/spec/controllers/ajax/inbox_controller_spec.rb @@ -4,8 +4,6 @@ require "rails_helper" describe Ajax::InboxController, :ajax_controller, type: :controller do - let(:user) { FactoryBot.create(:user) } - describe "#create" do subject { post(:create) } diff --git a/spec/controllers/ajax/question_controller_spec.rb b/spec/controllers/ajax/question_controller_spec.rb index 5a4b6727..add68805 100644 --- a/spec/controllers/ajax/question_controller_spec.rb +++ b/spec/controllers/ajax/question_controller_spec.rb @@ -3,8 +3,6 @@ require "rails_helper" describe Ajax::QuestionController, :ajax_controller, type: :controller do - let(:user) { FactoryBot.create(:user) } - describe "#create" do shared_examples "creates the question" do |check_for_inbox = true| it "creates the question" do diff --git a/spec/controllers/ajax/smile_controller_spec.rb b/spec/controllers/ajax/smile_controller_spec.rb index 7f509674..07a20de4 100644 --- a/spec/controllers/ajax/smile_controller_spec.rb +++ b/spec/controllers/ajax/smile_controller_spec.rb @@ -4,8 +4,6 @@ require "rails_helper" describe Ajax::SmileController, :ajax_controller, type: :controller do - let(:user) { FactoryBot.create(:user) } - describe "#create" do let(:params) do { diff --git a/spec/shared_examples/ajax_controllers.rb b/spec/shared_examples/ajax_controllers.rb index 144e216d..c5907548 100644 --- a/spec/shared_examples/ajax_controllers.rb +++ b/spec/shared_examples/ajax_controllers.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true RSpec.shared_context "AjaxController context" do + let(:user) { FactoryBot.create(:user) } + shared_examples "returns the expected response" do it "returns the expected response" do expect(JSON.parse(subject.body)).to match(expected_response)