Skip to content

Commit

Permalink
Add spec for singular / plural model
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-hill committed Dec 20, 2023
1 parent 17a573a commit a155808
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion spec/testing_record/model_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# frozen_string_literal: true

RSpec.describe TestingRecord::Model do
it { is_expected.to be_a(TestingRecord::Model) }
context 'when classified as a singular model' do
let(:model) do
Class.new(TestingRecord::Model) do
type :singular
end
end

it 'sets the singular model properties' do
expect(model.instance_variable_get(:@type)).to eq(:singular)
end
end

context 'when classified as a plural model' do
let(:model) do
Class.new(TestingRecord::Model) do
type :plural
end
end

it 'sets the singular model properties' do
expect(model.instance_variable_get(:@type)).to eq(:plural)
end
end
end

0 comments on commit a155808

Please sign in to comment.