Commit acc32dab authored by allison.browne's avatar allison.browne

Add scope tests to ZoomMeeting model

parent 01285cf8
......@@ -3175,8 +3175,8 @@ ActiveRecord::Schema.define(version: 2019_10_04_133612) do
t.string "tag"
t.text "description"
t.integer "project_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.text "description_html"
t.integer "cached_markdown_version"
t.integer "author_id"
......
......@@ -16,6 +16,27 @@ describe ZoomMeeting do
it { is_expected.to belong_to(:issue).required }
end
describe 'scopes' do
let(:issue) { create(:issue, project: project) }
let!(:added_meeting) { create(:zoom_meeting, :added_to_issue, issue: issue) }
let!(:removed_meeting) { create(:zoom_meeting, :removed_from_issue, issue: issue) }
describe '.added_to_issue' do
it 'gets only added meetings' do
meetings_added = ZoomMeeting.added_to_issue.pluck(:id)
expect(meetings_added).to include(added_meeting.id)
expect(meetings_added).not_to include(removed_meeting.id)
end
end
describe '.removed_from_issue' do
it 'gets only removed meetings' do
meetings_removed = ZoomMeeting.removed_from_issue.pluck(:id)
expect(meetings_removed).to include(removed_meeting.id)
expect(meetings_removed).to_not include(added_meeting.id)
end
end
end
describe 'Validations' do
describe 'url' do
it { is_expected.to validate_presence_of(:url) }
......
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