From 038a0d20cb741e66b4cb470bd6916259b205efc1 Mon Sep 17 00:00:00 2001 From: Washington Botelho Date: Fri, 26 Jan 2018 19:32:45 -0200 Subject: [PATCH] spec: fix missing metadata attribute --- spec/models/rate/create_spec.rb | 10 ++++------ spec/models/rate/rate_for_spec.rb | 4 ++-- spec/support/migrate.rb | 1 + 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/models/rate/create_spec.rb b/spec/models/rate/create_spec.rb index 9e3c684..bb326bc 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 { described_class.create author: author, resource: article, value: 3 } + before { described_class.create author: author, metadata: {}, 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 { described_class.create author: author_2, resource: article, value: 4 } + before { described_class.create author: author_2, metadata: {}, 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 { described_class.create author: author, resource: article, scopeable: category, value: 3 } + before { described_class.create author: author, metadata: {}, 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 { described_class.create author: author_2, resource: article, scopeable: category, value: 4 } + before { described_class.create author: author_2, metadata: {}, 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') @@ -130,8 +130,6 @@ RSpec.describe Rating::Rate, ':create' do end context 'with metadata' do - before { AddCommentOnRatingRatesTable.new.change } - context 'with nil value' do it 'creates a rate entry ignoring metadata' do described_class.create author: author, metadata: nil, resource: article, value: 3 diff --git a/spec/models/rate/rate_for_spec.rb b/spec/models/rate/rate_for_spec.rb index fb8cb69..ca8c6d3 100644 --- a/spec/models/rate/rate_for_spec.rb +++ b/spec/models/rate/rate_for_spec.rb @@ -12,7 +12,7 @@ RSpec.describe Rating::Rate, ':rate_for' do end context 'when rate does not exist' do - before { described_class.create author: author, resource: article, value: 3 } + before { described_class.create author: author, metadata: {}, resource: article, value: 3 } it 'returns the record' do expect(described_class.rate_for(author: author, resource: article)).to eq described_class.last @@ -28,7 +28,7 @@ RSpec.describe Rating::Rate, ':rate_for' do end context 'when rate does not exist' do - before { described_class.create author: author, resource: article, scopeable: category, value: 3 } + before { described_class.create author: author, metadata: {}, resource: article, scopeable: category, value: 3 } it 'returns the record' do query = described_class.rate_for(author: author, resource: article, scopeable: category) diff --git a/spec/support/migrate.rb b/spec/support/migrate.rb index 33937e7..4c064c9 100644 --- a/spec/support/migrate.rb +++ b/spec/support/migrate.rb @@ -8,3 +8,4 @@ CreateArticlesTable.new.change CreateAuthorsTable.new.change CreateCategoriesTable.new.change CreateRatingTables.new.change +AddCommentOnRatingRatesTable.new.change