Skip to content

Commit

Permalink
Lint files with Rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi committed Feb 14, 2023
1 parent 5715adc commit 03f0293
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 12 deletions.
3 changes: 1 addition & 2 deletions app/models/decidim/navigation_maps/blueprint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ class Blueprint < ApplicationRecord
class_name: "Decidim::NavigationMaps::BlueprintArea",
dependent: :destroy

validates :organization, presence: true
validates :height, numericality: { greater_than: 0 }

has_one_attached :image
validates_upload :image, uploader: Decidim::NavigationMaps::BlueprintUploader

def blueprint
areas.map { |area| [area.area_id.to_s, area.to_geoson] }.to_h
areas.to_h { |area| [area.area_id.to_s, area.to_geoson] }
end
end
end
Expand Down
2 changes: 0 additions & 2 deletions app/models/decidim/navigation_maps/blueprint_area.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class BlueprintArea < ApplicationRecord

attribute :link_type, :string, default: "link"

validates :blueprint, presence: true

def to_geoson
{
type: area_type,
Expand Down
2 changes: 1 addition & 1 deletion db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

print "Skipping seeds for decidim_navigation maps as required by SKIP_MODULE_SEEDS\n" if ENV["SKIP_MODULE_SEEDS"]

if !ENV["SKIP_MODULE_SEEDS"] && (!Rails.env.production? || ENV["SEED"])
if !ENV["SKIP_MODULE_SEEDS"] && (!Rails.env.production? || ENV.fetch("SEED", nil))

print "Creating seeds for decidim_navigation maps...\n" unless Rails.env.test?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ namespace :navigation_maps do
path = Rails.root.join("tmp/navigation_maps_editor_images_mappings.csv")
dirname = File.dirname(path)
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
File.open(path, "wb") do |file|
file.write(Decidim::Exporters::CSV.new(routes_mappings).export.read)
end
File.binwrite(path, Decidim::Exporters::CSV.new(routes_mappings).export.read)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/commands/save_area_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module Decidim::NavigationMaps
end

it "updates the area" do
expect { subject.call }.to change(BlueprintArea, :count).by(0)
expect { subject.call }.not_to change(BlueprintArea, :count)
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/forms/blueprint_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module Decidim::NavigationMaps
end

it "image? responds true" do
expect(subject.image?).to eq(true)
expect(subject.image?).to be(true)
end
end

Expand Down Expand Up @@ -84,7 +84,7 @@ module Decidim::NavigationMaps
let(:image) { nil }

it "image? responds false" do
expect(subject.image?).not_to eq(true)
expect(subject.image?).not_to be(true)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/navigation_map_cell_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def initialize(organization, content_block)

describe "#valid_blueprints?" do
it "returns true" do
expect(instance.valid_blueprints?).to eq(true)
expect(instance.valid_blueprints?).to be(true)
end
end

Expand Down

0 comments on commit 03f0293

Please sign in to comment.