Move models to Geo namespace

parent 846106a0
module Geo
module Model
extend ActiveSupport::Concern
included do
def self.table_name_prefix
"geo_"
end
end
end
end
module Geo
class EventLog < ActiveRecord::Base
include Geo::Model
belongs_to :push_event, class_name: 'Geo::PushEvent', foreign_key: 'push_event_id'
end
end
module Geo
class PushEvent < ActiveRecord::Base
include Geo::Model
belongs_to :project
validates :project, presence: true
enum event_type: { repository_updated: 0, wiki_updated: 1 }
end
end
class GeoEventLog < ActiveRecord::Base
belongs_to :push_event, class_name: 'GeoPushEvent', foreign_key: 'push_event_id'
end
class GeoPushEvent < ActiveRecord::Base
belongs_to :project
validates :project, presence: true
enum event_type: { repository_updated: 0, wiki_updated: 1 }
end
......@@ -10,6 +10,6 @@
# end
#
ActiveSupport::Inflector.inflections do |inflect|
inflect.uncountable %w(award_emoji project_statistics system_note_metadata geo_event_log project_registry file_registry)
inflect.uncountable %w(award_emoji project_statistics system_note_metadata event_log project_registry file_registry)
inflect.acronym 'EE'
end
require 'rails_helper'
RSpec.describe Geo::EventLog, type: :model do
describe 'relationships' do
it { is_expected.to belong_to(:push_event).class_name('Geo::PushEvent').with_foreign_key('push_event_id') }
end
end
require 'rails_helper'
RSpec.describe GeoPushEvent, type: :model do
RSpec.describe Geo::PushEvent, type: :model do
describe 'relationships' do
it { is_expected.to belong_to(:project) }
end
......
require 'rails_helper'
RSpec.describe GeoEventLog, type: :model do
describe 'relationships' do
it { is_expected.to belong_to(:push_event).class_name('GeoPushEvent').with_foreign_key('push_event_id') }
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment