Rename
This commit is contained in:
parent
a9f7558509
commit
77331530cb
9 changed files with 15 additions and 15 deletions
|
@ -1,12 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CountryStatesController < ApplicationController
|
||||
class FederalSubjectsController < ApplicationController
|
||||
before_action :set_country_state, except: :index
|
||||
|
||||
# GET /country_states
|
||||
def index
|
||||
authorize :country_state
|
||||
@country_states = policy_scope(CountryState)
|
||||
@country_states = policy_scope(FederalSubject)
|
||||
end
|
||||
|
||||
# GET /country_states/:id
|
||||
|
@ -17,6 +17,6 @@ class CountryStatesController < ApplicationController
|
|||
private
|
||||
|
||||
def set_country_state
|
||||
@country_state = CountryState.find params[:id]
|
||||
@country_state = FederalSubject.find params[:id]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CountryState < ApplicationRecord
|
||||
class FederalSubject < ApplicationRecord
|
||||
################
|
||||
# Associations #
|
||||
################
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CountryStatePolicy < ApplicationPolicy
|
||||
class FederalSubjectPolicy < ApplicationPolicy
|
||||
def index?
|
||||
true
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<% if policy(:country_state).index? %>
|
||||
<li class="nav-item <%= :active if country_states_controller? %>">
|
||||
<%= link_to country_states_path, class: 'nav-link' do %>
|
||||
<%= CountryState.model_name.human count: 0 %>
|
||||
<%= FederalSubject.model_name.human count: 0 %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th scope="col">
|
||||
<%= CountryState.human_attribute_name :english_name %>
|
||||
<%= FederalSubject.human_attribute_name :english_name %>
|
||||
</th>
|
||||
<th scope="col">
|
||||
<%= CountryState.human_attribute_name :native_name %>
|
||||
<%= FederalSubject.human_attribute_name :native_name %>
|
||||
</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
|
|
|
@ -9,7 +9,7 @@ CSV.foreach country_states_filename,
|
|||
native_name.strip!
|
||||
english_name.strip!
|
||||
|
||||
CountryState.where(english_name: english_name)
|
||||
FederalSubject.where(english_name: english_name)
|
||||
.first_or_create! do |new_country_state|
|
||||
new_country_state.native_name = native_name
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
FactoryBot.define do
|
||||
factory :country_state do
|
||||
initialize_with do
|
||||
CountryState.find_or_initialize_by english_name: english_name
|
||||
FederalSubject.find_or_initialize_by english_name: english_name
|
||||
end
|
||||
|
||||
english_name do
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CountryState do
|
||||
RSpec.describe FederalSubject do
|
||||
subject { create :country_state }
|
||||
|
||||
it do
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CountryStatePolicy do
|
||||
RSpec.describe FederalSubjectPolicy do
|
||||
subject { described_class.new current_account, record }
|
||||
|
||||
let :resolved_scope do
|
||||
described_class::Scope.new(current_account, CountryState.all).resolve
|
||||
described_class::Scope.new(current_account, FederalSubject.all).resolve
|
||||
end
|
||||
|
||||
let!(:record) { create :country_state }
|
||||
|
@ -20,7 +20,7 @@ RSpec.describe CountryStatePolicy do
|
|||
it { is_expected.to forbid_edit_and_update_actions }
|
||||
it { is_expected.to forbid_action :destroy }
|
||||
|
||||
specify { expect(resolved_scope).to eq CountryState.all }
|
||||
specify { expect(resolved_scope).to eq FederalSubject.all }
|
||||
|
||||
specify { expect(resolved_scope).to include record }
|
||||
specify { expect(resolved_scope).to include other_record }
|
||||
|
|
Reference in a new issue