Commit 11a559f7 authored by Andreas Brandl's avatar Andreas Brandl

Singularize model name.

parent 8a7cd25d
......@@ -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
class UserInteractedProjects < ActiveRecord::Base
class UserInteractedProject < ActiveRecord::Base
belongs_to :user
belongs_to :project
......
......@@ -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
......
require 'spec_helper'
describe UserInteractedProjects do
describe UserInteractedProject do
describe '.track' do
subject { described_class.track(event) }
let(:event) { build(:event) }
......
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