diff --git a/spec/factories/definitions.rb b/spec/factories/definitions.rb new file mode 100644 index 0000000..19046f3 --- /dev/null +++ b/spec/factories/definitions.rb @@ -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 diff --git a/spec/models/definition_spec.rb b/spec/models/definition_spec.rb new file mode 100644 index 0000000..d22850f --- /dev/null +++ b/spec/models/definition_spec.rb @@ -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 diff --git a/spec/models/word_spec.rb b/spec/models/word_spec.rb new file mode 100644 index 0000000..46fb15f --- /dev/null +++ b/spec/models/word_spec.rb @@ -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