Rspec and rubocop fixes

This commit is contained in:
farhatahmad 2019-05-22 13:51:55 -04:00
parent 70acb9a7e1
commit e90ca9cf48
4 changed files with 8 additions and 7 deletions

View File

@ -22,7 +22,8 @@ class AdminsController < ApplicationController
include Emailer include Emailer
manage_users = [:edit_user, :promote, :demote, :ban_user, :unban_user, :approve] manage_users = [:edit_user, :promote, :demote, :ban_user, :unban_user, :approve]
site_settings = [:branding, :coloring, :coloring_lighten, :coloring_darken, :registration_method, :room_authentication] site_settings = [:branding, :coloring, :coloring_lighten, :coloring_darken,
:registration_method, :room_authentication]
authorize_resource class: false authorize_resource class: false
before_action :find_user, only: manage_users before_action :find_user, only: manage_users

View File

@ -84,7 +84,7 @@ describe RoomsController, type: :controller do
end end
it "sets the join name to cookie[:greenlight_name] if it exists" do it "sets the join name to cookie[:greenlight_name] if it exists" do
name = Faker::Pokemon.name name = Faker::Games::Pokemon.name
@request.cookies[:greenlight_name] = name @request.cookies[:greenlight_name] = name
get :show, params: { room_uid: @owner.main_room } get :show, params: { room_uid: @owner.main_room }
@ -115,7 +115,7 @@ describe RoomsController, type: :controller do
it "should create room with name and correct settings" do it "should create room with name and correct settings" do
@request.session[:user_id] = @owner.id @request.session[:user_id] = @owner.id
name = Faker::Pokemon.name name = Faker::Games::Pokemon.name
room_params = { name: name, "client": "html5", "mute_on_join": "1" } room_params = { name: name, "client": "html5", "mute_on_join": "1" }
json_room_settings = "{\"muteOnStart\":true,\"joinViaHtml5\":true}" json_room_settings = "{\"muteOnStart\":true,\"joinViaHtml5\":true}"
@ -131,7 +131,7 @@ describe RoomsController, type: :controller do
it "it should redirect to root if not logged in" do it "it should redirect to root if not logged in" do
expect do expect do
name = Faker::Pokemon.name name = Faker::Games::Pokemon.name
post :create, params: { room: { name: name } } post :create, params: { room: { name: name } }
end.to change { Room.count }.by(0) end.to change { Room.count }.by(0)
@ -288,7 +288,7 @@ describe RoomsController, type: :controller do
it "properly updates room name through the room settings modal and redirects to current page" do it "properly updates room name through the room settings modal and redirects to current page" do
@request.session[:user_id] = @user.id @request.session[:user_id] = @user.id
name = Faker::Pokemon.name name = Faker::Games::Pokemon.name
room_params = { room_uid: @secondary_room.uid, room: { "name": name } } room_params = { room_uid: @secondary_room.uid, room: { "name": name } }

View File

@ -32,7 +32,7 @@ FactoryBot.define do
end end
factory :room do factory :room do
name { Faker::Pokemon.name } name { Faker::Games::Pokemon.name }
owner { create(:user) } owner { create(:user) }
end end
end end