spec: move user to shared context
This commit is contained in:
parent
54532c71e1
commit
137743001f
|
@ -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 }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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) }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue