From 546101a35708a547386fa7daa66e16b588dc76c1 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 13 May 2019 10:16:50 +0800 Subject: [PATCH] Add frozen string literal to files. --- Gemfile | 2 ++ app/controllers/house_ad_settings_controller.rb | 2 ++ app/controllers/house_ads_controller.rb | 2 ++ app/models/house_ad.rb | 2 ++ app/models/house_ad_setting.rb | 2 ++ bin/pull_translations.rb | 1 + plugin.rb | 2 ++ spec/models/house_ad_setting_spec.rb | 2 ++ spec/models/house_ad_spec.rb | 4 +++- spec/requests/house_ad_settings_controller_spec.rb | 2 ++ 10 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 6ac5785..4ba4089 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' group :development do diff --git a/app/controllers/house_ad_settings_controller.rb b/app/controllers/house_ad_settings_controller.rb index 62d6b73..190f506 100644 --- a/app/controllers/house_ad_settings_controller.rb +++ b/app/controllers/house_ad_settings_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ::AdPlugin class HouseAdSettingsController < ::ApplicationController requires_plugin AdPlugin.plugin_name diff --git a/app/controllers/house_ads_controller.rb b/app/controllers/house_ads_controller.rb index 510b62a..c1e140a 100644 --- a/app/controllers/house_ads_controller.rb +++ b/app/controllers/house_ads_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ::AdPlugin class HouseAdsController < ::ApplicationController requires_plugin AdPlugin.plugin_name diff --git a/app/models/house_ad.rb b/app/models/house_ad.rb index ab467de..fb54820 100644 --- a/app/models/house_ad.rb +++ b/app/models/house_ad.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ::AdPlugin class HouseAd include ActiveModel::Validations diff --git a/app/models/house_ad_setting.rb b/app/models/house_ad_setting.rb index fe0eb33..396f0be 100644 --- a/app/models/house_ad_setting.rb +++ b/app/models/house_ad_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ::AdPlugin class HouseAdSetting DEFAULTS = { diff --git a/bin/pull_translations.rb b/bin/pull_translations.rb index 755a227..789ccaa 100755 --- a/bin/pull_translations.rb +++ b/bin/pull_translations.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # Usage: # bundle install diff --git a/plugin.rb b/plugin.rb index 20228d6..0205b8c 100755 --- a/plugin.rb +++ b/plugin.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # name: discourse-adplugin # about: Ad Plugin for Discourse # version: 1.2.0 diff --git a/spec/models/house_ad_setting_spec.rb b/spec/models/house_ad_setting_spec.rb index 28cfe15..1e21071 100644 --- a/spec/models/house_ad_setting_spec.rb +++ b/spec/models/house_ad_setting_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' describe AdPlugin::HouseAdSetting do diff --git a/spec/models/house_ad_spec.rb b/spec/models/house_ad_spec.rb index 6c511e0..b28cdb3 100644 --- a/spec/models/house_ad_spec.rb +++ b/spec/models/house_ad_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' describe AdPlugin::HouseAd do @@ -117,7 +119,7 @@ describe AdPlugin::HouseAd do end it "validates attributes" do - ad = AdPlugin::HouseAd.create({name: '', html: ''}) + ad = AdPlugin::HouseAd.create(name: '', html: '') expect(ad).to be_a(AdPlugin::HouseAd) expect(ad).to_not be_valid expect(ad.errors.full_messages).to be_present diff --git a/spec/requests/house_ad_settings_controller_spec.rb b/spec/requests/house_ad_settings_controller_spec.rb index 8f0bfa2..76f652e 100644 --- a/spec/requests/house_ad_settings_controller_spec.rb +++ b/spec/requests/house_ad_settings_controller_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' describe AdPlugin::HouseAdSettingsController do