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

Singularize model name.

parent 8a7cd25d
...@@ -395,6 +395,6 @@ class Event < ActiveRecord::Base ...@@ -395,6 +395,6 @@ class Event < ActiveRecord::Base
# Note the call to .available? is due to earlier migrations # Note the call to .available? is due to earlier migrations
# that would otherwise conflict with the call to .track # that would otherwise conflict with the call to .track
# (because the table does not exist yet). # (because the table does not exist yet).
UserInteractedProjects.track(self) if UserInteractedProjects.available? UserInteractedProject.track(self) if UserInteractedProject.available?
end end
end end
class UserInteractedProjects < ActiveRecord::Base class UserInteractedProject < ActiveRecord::Base
belongs_to :user belongs_to :user
belongs_to :project belongs_to :project
......
...@@ -53,15 +53,15 @@ describe Event do ...@@ -53,15 +53,15 @@ describe Event do
describe 'after_create :track_user_interacted_projects' do describe 'after_create :track_user_interacted_projects' do
let(:event) { build(:push_event, project: project, author: project.owner) } let(:event) { build(:push_event, project: project, author: project.owner) }
it 'passes event to UserInteractedProjects.track' do it 'passes event to UserInteractedProject.track' do
expect(UserInteractedProjects).to receive(:available?).and_return(true) expect(UserInteractedProject).to receive(:available?).and_return(true)
expect(UserInteractedProjects).to receive(:track).with(event) expect(UserInteractedProject).to receive(:track).with(event)
event.save event.save
end end
it 'does not call UserInteractedProjects.track if its not yet available' do it 'does not call UserInteractedProject.track if its not yet available' do
expect(UserInteractedProjects).to receive(:available?).and_return(false) expect(UserInteractedProject).to receive(:available?).and_return(false)
expect(UserInteractedProjects).not_to receive(:track) expect(UserInteractedProject).not_to receive(:track)
event.save event.save
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe UserInteractedProjects do describe UserInteractedProject do
describe '.track' do describe '.track' do
subject { described_class.track(event) } subject { described_class.track(event) }
let(:event) { build(: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