Skip to content

Commit

Permalink
adapt spec setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ulferts committed Jun 11, 2024
1 parent 376d345 commit ae15182
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
18 changes: 4 additions & 14 deletions modules/meeting/spec/controllers/meetings_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,11 @@
require "#{File.dirname(__FILE__)}/../spec_helper"

RSpec.describe MeetingsController do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:other_project) { create(:project) }
shared_let(:user) { create(:admin) }
shared_let(:project) { create(:project) }
shared_let(:other_project) { create(:project) }

before do
allow(User).to receive(:current).and_return user

allow(Project).to receive(:find).and_return(project)

allow(controller).to receive(:authorize)
allow(controller).to receive(:authorize_global)
allow(controller).to receive(:check_if_login_required)
end
current_user { user }

describe "GET" do
describe "index" do
Expand Down Expand Up @@ -161,8 +153,6 @@
let(:meeting_params) { base_meeting_params }

before do
allow(Project).to receive(:find).and_return(project)

post :create,
params:
end
Expand Down
6 changes: 5 additions & 1 deletion modules/reporting/spec/workers/cost_query/export_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
require "spec_helper"

RSpec.describe CostQuery::ExportJob do
let(:user) { build_stubbed(:admin) }
let(:user) { build_stubbed(:user) }
let(:project) { build_stubbed(:project) }

let(:initial_filter_params) do
Expand All @@ -46,6 +46,10 @@
}
end

before do
mock_permissions_for(user, &:allow_everything)
end

# Performs a cost export with the given extra filters.
#
# @param extra_filters [Hash] A hash of attribute names and operator/value
Expand Down
2 changes: 2 additions & 0 deletions spec/controllers/activities_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

RSpec.describe ActivitiesController do
shared_let(:admin) { create(:admin) }
shared_let(:project) { create(:project) }

current_user { admin }

before do
Expand Down
1 change: 1 addition & 0 deletions spec/requests/rate_limiting/api_v3_rate_limiting_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
include Rack::Test::Methods
include API::V3::Utilities::PathHelper

shared_let(:project) { create(:project) }
current_user { create(:admin) }

context "when enabled", with_config: { rate_limiting: { api_v3: true } } do
Expand Down

0 comments on commit ae15182

Please sign in to comment.