fix: was calling factory over create method

we test using the method not just the persisted result
main
Washington Botelho 2018-01-26 19:07:37 -02:00
parent 0b6c6879db
commit 55cd7a3093
No known key found for this signature in database
GPG Key ID: 5DE4F42A8F073617
1 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ RSpec.describe Rating::Rate, ':create' do
let!(:article) { create :article } let!(:article) { create :article }
context 'with no scopeable' do 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 context 'when rate does not exist yet' do
it 'creates a rate entry' do it 'creates a rate entry' do
@ -32,7 +32,7 @@ RSpec.describe Rating::Rate, ':create' do
context 'when rate already exists' do context 'when rate already exists' do
let!(:author_2) { create :author } 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 it 'creates one more rate entry' do
rates = described_class.where(author: [author, author_2]).order('created_at asc') 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 context 'with scopeable' do
let!(:category) { create :category } 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 context 'when rate does not exist yet' do
it 'creates a rate entry' do it 'creates a rate entry' do
@ -94,7 +94,7 @@ RSpec.describe Rating::Rate, ':create' do
context 'when rate already exists' do context 'when rate already exists' do
let!(:author_2) { create :author } 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 it 'creates one more rate entry' do
rates = described_class.where(author: [author, author_2]).order('created_at asc') rates = described_class.where(author: [author, author_2]).order('created_at asc')