Remove obsolete specs

This commit is contained in:
Alberto Miedes Garcés
2017-01-25 13:58:44 +01:00
parent e3fca5c49f
commit e7f55b10e2
8 changed files with 3 additions and 79 deletions

View File

@@ -244,10 +244,6 @@ class User < ActiveRecord::Base
end
delegate :can?, :cannot?, to: :ability
def age_range
AgeRangeCalculator::range_from_birthday(self.date_of_birth).to_s
end
private
def clean_document_number

View File

@@ -1,17 +1,12 @@
require 'rails_helper'
# ------------------------------------------------------------------------------
api_types_creator = GraphQL::ApiTypesCreator.new(API_TYPE_DEFINITIONS)
created_api_types = api_types_creator.create
query_type_creator = GraphQL::QueryTypeCreator.new(created_api_types)
QueryType = query_type_creator.create
api_types = GraphQL::ApiTypesCreator.new(API_TYPE_DEFINITIONS).create
query_type = GraphQL::QueryTypeCreator.new(api_types).create
ConsulSchema = GraphQL::Schema.define do
query QueryType
query query_type
max_depth 12
end
# ------------------------------------------------------------------------------
def execute(query_string, context = {}, variables = {})
ConsulSchema.execute(query_string, context: context, variables: variables)

View File

@@ -4,7 +4,6 @@ describe Comment do
let(:comment) { build(:comment) }
it_behaves_like "public_voters_stats"
it_behaves_like "has_public_author"
it "is valid" do

View File

@@ -1,39 +0,0 @@
require 'spec_helper'
shared_examples_for 'public_voters_stats' do
let(:model) { described_class } # the class that includes the concern
describe 'votes_above_threshold?' do
let(:votable) { create(model.to_s.underscore.to_sym) }
context 'with default threshold value' do
it 'is true when votes are above threshold' do
200.times { create(:vote, votable: votable) }
expect(votable.votes_above_threshold?).to be_truthy
end
it 'is false when votes are under threshold' do
199.times { create(:vote, votable: votable) }
expect(votable.votes_above_threshold?).to be_falsey
end
end
context 'with custom threshold value' do
it 'is true when votes are above threshold' do
create(:setting, key: "#{model.to_s.underscore}_api_votes_threshold", value: '2')
2.times { create(:vote, votable: votable) }
expect(votable.votes_above_threshold?).to be_truthy
end
it 'is false when votes are under threshold' do
create(:setting, key: "#{model.to_s.underscore}_api_votes_threshold", value: '2')
create(:vote, votable: votable)
expect(votable.votes_above_threshold?).to be_falsey
end
end
end
end

View File

@@ -4,7 +4,6 @@ require 'rails_helper'
describe Debate do
let(:debate) { build(:debate) }
it_behaves_like "public_voters_stats"
it_behaves_like "has_public_author"
it "should be valid" do

View File

@@ -4,7 +4,6 @@ require 'rails_helper'
describe Proposal do
let(:proposal) { build(:proposal) }
it_behaves_like "public_voters_stats"
it_behaves_like "has_public_author"
it "should be valid" do

View File

@@ -469,10 +469,4 @@ describe User do
end
describe "#age_range" do
it 'returns string representation of age range' do
user = create(:user, date_of_birth: Time.current - 41.years)
expect(user.age_range).to eq('41..60')
end
end
end

View File

@@ -92,25 +92,6 @@ describe 'Vote' do
end
end
describe 'public_voter' do
it 'only returns voter if votable has enough votes' do
create(:setting, key: 'proposal_api_votes_threshold', value: '2')
proposal_1 = create(:proposal)
proposal_2 = create(:proposal)
voter_1 = create(:user)
voter_2 = create(:user)
vote_1 = create(:vote, votable: proposal_1, voter: voter_1)
vote_2 = create(:vote, votable: proposal_2, voter: voter_1)
vote_3 = create(:vote, votable: proposal_2, voter: voter_2)
expect(vote_1.public_voter).to be_nil
expect(vote_2.public_voter).to eq(voter_1)
end
end
describe '#public_timestamp' do
it "truncates created_at timestamp up to minutes" do
vote = create(:vote, created_at: Time.zone.parse('2016-02-10 15:30:45'))