Rspec and rubocop fixes

v2
farhatahmad 4 years ago
parent 70acb9a7e1
commit e90ca9cf48
  1. 3
      app/controllers/admins_controller.rb
  2. 8
      spec/controllers/rooms_controller_spec.rb
  3. 2
      spec/factories.rb
  4. 2
      test/mailers/previews/user_mailer_preview.rb

@ -22,7 +22,8 @@ class AdminsController < ApplicationController
include Emailer
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
before_action :find_user, only: manage_users

@ -84,7 +84,7 @@ describe RoomsController, type: :controller do
end
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
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
@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" }
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
expect do
name = Faker::Pokemon.name
name = Faker::Games::Pokemon.name
post :create, params: { room: { name: name } }
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
@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 } }

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

@ -49,7 +49,7 @@ class UserMailerPreview < ActionMailer::Preview
user = User.first
UserMailer.invite_user_signup(user, "http://example.com/", @logo, @color, "test@example.com")
end
# http://localhost:3000/rails/mailers/user_mailer/user_promoted
def user_promoted
user = User.first