From 55cd7a30932a9afe47223e9a94cd6b31794fb5f6 Mon Sep 17 00:00:00 2001 From: Washington Botelho Date: Fri, 26 Jan 2018 19:07:37 -0200 Subject: [PATCH] fix: was calling factory over create method we test using the method not just the persisted result --- spec/models/rate/create_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/models/rate/create_spec.rb b/spec/models/rate/create_spec.rb index 5e94611..fb319a3 100644 --- a/spec/models/rate/create_spec.rb +++ b/spec/models/rate/create_spec.rb @@ -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')