Skip to content

Commit

Permalink
code clenaup
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-brousse committed Aug 7, 2024
1 parent c9520c5 commit 33eb8eb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 57 deletions.
1 change: 0 additions & 1 deletion app/views/visualization/infrastructures/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"Infrastructure" => nil,
} %>


<div data-turbo="true">
<div class="container-fluid">
<%= render CardComponent.new(type: :primary) do |card| %>
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/field_with_errors.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

ActionView::Base.field_error_proc = proc do |html_tag, instance|
html_tag.html_safe
html_tag.html_safe # rubocop:disable Rails/OutputSafety
end
48 changes: 0 additions & 48 deletions spec/requests/islets_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,52 +182,4 @@
it { expect(response).to redirect_to(islets_path) }
end
end

describe "#infrastructure" do
subject(:response) do
get infrastructure_room_islet_path(islet.room, islet, params:)

# NOTE: used to simplify usage and custom test done in final spec file.
@response # rubocop:disable RSpec/InstanceVariable
end

let(:params) { {} }

include_context "with authenticated user"

context "with not params" do
pending
end

context "with correct params" do
let(:params) { { network_type: :gbe } }

it { expect(response).to have_http_status(:success) }
it { expect(response).to render_template(:infrastructure) }
end
end

describe "#network_capacity" do
subject(:response) do
get network_capacity_room_islet_path(islet.room, islet, params:)

# NOTE: used to simplify usage and custom test done in final spec file.
@response # rubocop:disable RSpec/InstanceVariable
end

let(:params) { {} }

include_context "with authenticated user"

context "with not params" do
pending
end

context "with correct params" do
let(:params) { { network_type: :gbe } }

it { expect(response).to have_http_status(:success) }
it { expect(response).to render_template(:network_capacity) }
end
end
end
2 changes: 1 addition & 1 deletion spec/requests/users/settings_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
context "with invalid data" do
let(:params) { { user: { locale: "test", theme: "yellow" } } }

it { expect(response).to have_http_status(:unprocessable_entity) }
it { expect(response).to have_http_status(:unprocessable_content) }
it { expect(response).to render_template(:edit) }
end

Expand Down
8 changes: 5 additions & 3 deletions spec/requests/visualization/infrastructure_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
before { sign_in user }

describe "GET #show" do
before { get visualization_infrastructure_path }
context "when filter is not filled" do
before { get visualization_infrastructure_path }

it { expect(response).to have_http_status(:success) }
it { expect(response).to render_template(:show) }
it { expect(response).to have_http_status(:redirect) }
it { expect(response).to redirect_to(visualization_infrastructure_path(islet_id: 1, network_type: :gbe)) }
end
end
end
8 changes: 5 additions & 3 deletions spec/requests/visualization/network_capacity_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
before { sign_in user }

describe "GET #show" do
before { get visualization_network_capacity_path }
context "when filter is not filled" do
before { get visualization_network_capacity_path }

it { expect(response).to have_http_status(:success) }
it { expect(response).to render_template(:show) }
it { expect(response).to have_http_status(:redirect) }
it { expect(response).to redirect_to(visualization_network_capacity_path(islet_id: 1, network_type: :gbe)) }
end
end
end

0 comments on commit 33eb8eb

Please sign in to comment.