Singularize model name.

This commit is contained in:
Andreas Brandl 2018-03-03 20:00:05 +01:00
parent 8a7cd25d08
commit 11a559f7c9
4 changed files with 9 additions and 9 deletions

View file

@ -395,6 +395,6 @@ class Event < ActiveRecord::Base
# Note the call to .available? is due to earlier migrations
# that would otherwise conflict with the call to .track
# (because the table does not exist yet).
UserInteractedProjects.track(self) if UserInteractedProjects.available?
UserInteractedProject.track(self) if UserInteractedProject.available?
end
end

View file

@ -1,4 +1,4 @@
class UserInteractedProjects < ActiveRecord::Base
class UserInteractedProject < ActiveRecord::Base
belongs_to :user
belongs_to :project

View file

@ -53,15 +53,15 @@ describe Event do
describe 'after_create :track_user_interacted_projects' do
let(:event) { build(:push_event, project: project, author: project.owner) }
it 'passes event to UserInteractedProjects.track' do
expect(UserInteractedProjects).to receive(:available?).and_return(true)
expect(UserInteractedProjects).to receive(:track).with(event)
it 'passes event to UserInteractedProject.track' do
expect(UserInteractedProject).to receive(:available?).and_return(true)
expect(UserInteractedProject).to receive(:track).with(event)
event.save
end
it 'does not call UserInteractedProjects.track if its not yet available' do
expect(UserInteractedProjects).to receive(:available?).and_return(false)
expect(UserInteractedProjects).not_to receive(:track)
it 'does not call UserInteractedProject.track if its not yet available' do
expect(UserInteractedProject).to receive(:available?).and_return(false)
expect(UserInteractedProject).not_to receive(:track)
event.save
end
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe UserInteractedProjects do
describe UserInteractedProject do
describe '.track' do
subject { described_class.track(event) }
let(:event) { build(:event) }