Skip to content

Commit

Permalink
[#53620] fix rubocop issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Kharonus committed Sep 6, 2024
1 parent 735bc8e commit 6cf1427
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 14 deletions.
7 changes: 4 additions & 3 deletions app/controllers/oauth/applications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ def edit; end
def create
call = ::OAuth::Applications::CreateService.new(user: current_user)
.call(permitted_params.oauth_application)
result = call.result

if call.success?
flash[:notice] = t(:notice_successful_create)
flash[:_application_secret] = call.result.plaintext_secret
redirect_to action: :show, id: call.result.id
flash[:_application_secret] = result.plaintext_secret
redirect_to action: :show, id: result.id
else
@application = call.result
@application = result
render action: :new
end
end
Expand Down
6 changes: 4 additions & 2 deletions db/migrate/20240513135928_extend_oauth_applications.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class ExtendOAuthApplications < ActiveRecord::Migration[7.1]
def change
add_column :oauth_applications, :builtin, :boolean, default: false
add_column :oauth_applications, :enabled, :boolean, default: true
change_table :oauth_applications, bulk: true do |t|
t.add_column :enabled, :boolean, default: true, null: false
t.add_column :builtin, :boolean, default: false, null: false
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@

context "with a seeded application" do
before do
::OAuthApplicationsSeeder.new.seed_data!
OAuthApplicationsSeeder.new.seed_data!
end

it "does not allow editing or deleting the seeded application" do
Expand All @@ -105,14 +105,14 @@
expect(page).to have_css("td.builtin .icon-checkmark")
expect(page).to have_css("td.enabled .icon-checkmark")

expect(page).not_to have_css("td.buttons", text: "Edit")
expect(page).not_to have_css("td.buttons", text: "Delete")
expect(page).to have_no_css("td.buttons", text: "Edit")
expect(page).to have_no_css("td.buttons", text: "Delete")

expect(page).to have_css("td.buttons", text: "Deactivate")
click_link_or_button "Deactivate"

expect(page).to have_css("td.builtin .icon-checkmark")
expect(page).not_to have_css("td.enabled .icon-checkmark")
expect(page).to have_no_css("td.enabled .icon-checkmark")

app = Doorkeeper::Application.last
expect(app).to be_builtin
Expand Down
4 changes: 2 additions & 2 deletions spec/services/oauth/applications/create_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
require "spec_helper"
require "services/base_services/behaves_like_create_service"

RSpec.describe OAuth::Applications::CreateService, type: :model do
RSpec.describe OAuth::Applications::CreateService, type: :model do # rubocop:disable RSpec/SpecFilePathFormat
it_behaves_like "BaseServices create service" do
let(:factory) { :oauth_application }
let(:model_class) { Doorkeeper::Application }
let(:factory) { :oauth_application }
end
end
2 changes: 1 addition & 1 deletion spec/services/oauth/applications/delete_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
require "spec_helper"
require "services/base_services/behaves_like_delete_service"

RSpec.describe OAuth::Applications::DeleteService, type: :model do
RSpec.describe OAuth::Applications::DeleteService, type: :model do # rubocop:disable RSpec/SpecFilePathFormat
it_behaves_like "BaseServices delete service" do
let(:factory) { :oauth_application }
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

require "spec_helper"

RSpec.describe OAuth::Applications::SetAttributesService, type: :model do
RSpec.describe OAuth::Applications::SetAttributesService, type: :model do # rubocop:disable RSpec/SpecFilePathFormat
let(:current_user) { build_stubbed(:admin) }

let(:contract_instance) do
Expand Down
2 changes: 1 addition & 1 deletion spec/services/oauth/applications/update_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
require "spec_helper"
require "services/base_services/behaves_like_update_service"

RSpec.describe OAuth::Applications::UpdateService, type: :model do
RSpec.describe OAuth::Applications::UpdateService, type: :model do # rubocop:disable RSpec/SpecFilePathFormat
it_behaves_like "BaseServices update service" do
let(:factory) { :oauth_application }
end
Expand Down

0 comments on commit 6cf1427

Please sign in to comment.