Add model specs
This commit is contained in:
parent
21445b6905
commit
ad08b283b0
7
spec/factories/definitions.rb
Normal file
7
spec/factories/definitions.rb
Normal file
@ -0,0 +1,7 @@
|
||||
FactoryBot.define do
|
||||
factory :definition do
|
||||
pos { "n" }
|
||||
definition { "this is a definition" }
|
||||
word_id { FactoryBot.create(:word).id }
|
||||
end
|
||||
end
|
8
spec/models/definition_spec.rb
Normal file
8
spec/models/definition_spec.rb
Normal file
@ -0,0 +1,8 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Definition, type: :model do
|
||||
it "successfully creates a definition" do
|
||||
definition = FactoryBot.create(:definition)
|
||||
expect(Definition.count).to eq(1)
|
||||
end
|
||||
end
|
8
spec/models/word_spec.rb
Normal file
8
spec/models/word_spec.rb
Normal file
@ -0,0 +1,8 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Word, type: :model do
|
||||
it "successfully creates a new word" do
|
||||
word = FactoryBot.create(:word)
|
||||
expect(Word.count).to eq(1)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user