fix: was calling factory over create method
we test using the method not just the persisted resultmain
parent
0b6c6879db
commit
55cd7a3093
|
@ -7,7 +7,7 @@ RSpec.describe Rating::Rate, ':create' do
|
|||
let!(:article) { create :article }
|
||||
|
||||
context 'with no scopeable' do
|
||||
before { create :rating_rate, author: author, resource: article, value: 3 }
|
||||
before { described_class.create author: author, resource: article, value: 3 }
|
||||
|
||||
context 'when rate does not exist yet' do
|
||||
it 'creates a rate entry' do
|
||||
|
@ -32,7 +32,7 @@ RSpec.describe Rating::Rate, ':create' do
|
|||
context 'when rate already exists' do
|
||||
let!(:author_2) { create :author }
|
||||
|
||||
before { create :rating_rate, author: author_2, resource: article, value: 4 }
|
||||
before { described_class.create author: author_2, resource: article, value: 4 }
|
||||
|
||||
it 'creates one more rate entry' do
|
||||
rates = described_class.where(author: [author, author_2]).order('created_at asc')
|
||||
|
@ -67,7 +67,7 @@ RSpec.describe Rating::Rate, ':create' do
|
|||
context 'with scopeable' do
|
||||
let!(:category) { create :category }
|
||||
|
||||
before { create :rating_rate, author: author, resource: article, scopeable: category, value: 3 }
|
||||
before { described_class.create author: author, resource: article, scopeable: category, value: 3 }
|
||||
|
||||
context 'when rate does not exist yet' do
|
||||
it 'creates a rate entry' do
|
||||
|
@ -94,7 +94,7 @@ RSpec.describe Rating::Rate, ':create' do
|
|||
context 'when rate already exists' do
|
||||
let!(:author_2) { create :author }
|
||||
|
||||
before { create :rating_rate, author: author_2, resource: article, scopeable: category, value: 4 }
|
||||
before { described_class.create author: author_2, resource: article, scopeable: category, value: 4 }
|
||||
|
||||
it 'creates one more rate entry' do
|
||||
rates = described_class.where(author: [author, author_2]).order('created_at asc')
|
||||
|
|
Loading…
Reference in New Issue