Sha256: bb74b1485579b76ec5bea4beb732e31819ae54e67dabf48f0a41477706c212cc
Contents?: true
Size: 1.42 KB
Versions: 9
Compression:
Stored size: 1.42 KB
Contents
require "rails_helper" module ThinkFeelDoDashboard RSpec.describe ModeratorsController, type: :controller do routes { Engine.routes } describe "POST create" do context "for authenticated users" do let(:user) { instance_double(User, admin?: true) } before do sign_in_user user end describe "when Group is found" do before do expect(Group) .to receive(:find) do instance_double( Group, moderating_participant: user) end expect(controller).to receive(:sign_in).with(user) allow(controller) .to receive_message_chain("social_networking.social_networking_profile_path") .and_return "hello_world" end it "should respond with a redirect to the moderator's profile page" do post :create, group_id: 1 expect(response.status).to eq 302 expect(response.body).to match(/hello_world/) end end describe "when Group is not found" do it "should respond with a redirect" do post :create, group_id: 1 expect(response.status).to eq 302 end end end context "for unauthenticated users" do before { post :create, group_id: 1 } it_behaves_like "a rejected user action" end end end end
Version data entries
9 entries across 9 versions & 1 rubygems