Skip to content

Commit

Permalink
add module_release spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-coggin committed Dec 1, 2023
1 parent 61bf0e5 commit 375318f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion app/models/training/module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def debug_summary
SUMMARY
end

# TODO: add unit test and new model spec
# @return [DateTime, nil]
def first_published_at
ModuleRelease.find_by(module_position: position)&.first_published_at
Expand Down
10 changes: 10 additions & 0 deletions spec/models/module_release_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'rails_helper'

RSpec.describe ModuleRelease, type: :model do
describe '.ordered' do
include_context 'with module releases'
it 'returns module releases in order of module position' do
expect(described_class.ordered.map(&:module_position)).to eq([1, 2, 3])
end
end
end

0 comments on commit 375318f

Please sign in to comment.