Move blocks spec into proper controller
accidentally moved it into the `MutesController` fist
This commit is contained in:
parent
9c4a934959
commit
8446278e80
|
@ -0,0 +1,39 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe Settings::BlocksController, type: :controller do
|
||||||
|
let(:user) { FactoryBot.create(:user) }
|
||||||
|
|
||||||
|
describe "#index" do
|
||||||
|
subject { get :index }
|
||||||
|
|
||||||
|
context "user signed in" do
|
||||||
|
before(:each) { sign_in user }
|
||||||
|
|
||||||
|
it "shows the edit_blocks page" do
|
||||||
|
subject
|
||||||
|
expect(response).to have_rendered(:index)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "only contains blocks of the signed in user" do
|
||||||
|
other_user = create(:user)
|
||||||
|
other_user.block(user)
|
||||||
|
|
||||||
|
subject
|
||||||
|
|
||||||
|
expect(assigns(:blocks)).to eq(user.active_block_relationships)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "only contains anonymous blocks of the signed in user" do
|
||||||
|
other_user = create(:user)
|
||||||
|
question = create(:question)
|
||||||
|
other_user.anonymous_blocks.create(identifier: "very-real-identifier", question_id: question.id)
|
||||||
|
|
||||||
|
subject
|
||||||
|
|
||||||
|
expect(assigns(:anonymous_blocks)).to eq(user.anonymous_blocks)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,37 +3,18 @@
|
||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe Settings::MutesController, type: :controller do
|
describe Settings::MutesController, type: :controller do
|
||||||
let(:user) { FactoryBot.create(:user) }
|
|
||||||
|
|
||||||
describe "#index" do
|
describe "#index" do
|
||||||
subject { get :index }
|
subject { get :index }
|
||||||
|
|
||||||
context "user signed in" do
|
context "user signed in" do
|
||||||
before(:each) { sign_in user }
|
let(:user) { FactoryBot.create(:user) }
|
||||||
|
|
||||||
it "shows the edit_blocks page" do
|
before { sign_in user }
|
||||||
|
|
||||||
|
it "shows the index page" do
|
||||||
subject
|
subject
|
||||||
expect(response).to have_rendered(:index)
|
expect(response).to have_rendered(:index)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "only contains blocks of the signed in user" do
|
|
||||||
other_user = create(:user)
|
|
||||||
other_user.block(user)
|
|
||||||
|
|
||||||
subject
|
|
||||||
|
|
||||||
expect(assigns(:blocks)).to eq(user.active_block_relationships)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "only contains anonymous blocks of the signed in user" do
|
|
||||||
other_user = create(:user)
|
|
||||||
question = create(:question)
|
|
||||||
other_user.anonymous_blocks.create(identifier: "very-real-identifier", question_id: question.id)
|
|
||||||
|
|
||||||
subject
|
|
||||||
|
|
||||||
expect(assigns(:anonymous_blocks)).to eq(user.anonymous_blocks)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue