Remove warnings from test suite

pull/316/head
Rick Carlino 2017-03-08 08:41:51 -06:00
parent 1f15f389e5
commit d85bf62a86
5 changed files with 9 additions and 47 deletions

View File

@ -1,5 +1,5 @@
class FarmEventSerializer < ActiveModel::Serializer
attributes :id, :start_time, :end_time, :next_time, :repeat, :time_unit,
attributes :id, :start_time, :end_time, :repeat, :time_unit,
:executable_id, :executable_type, :calendar
def calendar

View File

@ -1,13 +0,0 @@
require "spec_helper"
describe FarmEvent do
describe '#calculate_next_occurence' do
let(:farm_event) { FactoryGirl.create(:farm_event) }
it 'indicates next_occurrence' do
pending("Probably going away.")
actual = farm_event.calculate_next_occurence
expected = farm_event.farm_event_rules.next_occurrence
expect(actual).to eq(expected)
end
end
end

View File

@ -23,18 +23,4 @@ describe FarmEvents::Create do
expect(farm_event.time_unit).to eq('minutely')
# expect(farm_event.next_time).to eq(farm_event.calculate_next_occurence)
end
it 'has a calendar' do
pending(
"SEE: https://github.com/seejohnrun/ice_cube/issues/378"
)
x = FarmEvents::Create.run!({ start_time: "2017-02-24T13:04:07.754Z",
end_time: "2017-02-26T13:30:00.000Z",
device: seq.device,
repeat: 2,
time_unit: "hourly",
executable_id: seq.id,
executable_type: seq.class.name })
expect(x.calendar.length).to eq(25)
end
end

View File

@ -2,7 +2,7 @@ require 'spec_helper'
describe Users::Create do
it 'enforces terms of service' do
User::ENFORCE_TOS = true
const_reassign(User, :ENFORCE_TOS, true)
results = Users::Create.run(email: "xyz@qwerty.io",
name: "Faker",
password: "password12345",
@ -10,11 +10,11 @@ describe Users::Create do
agree_to_terms: false)
tos = results.errors.message["terms_of_service"] || ""
expect(tos).to include("must agree")
User::ENFORCE_TOS = false
const_reassign(User, :ENFORCE_TOS, false)
end
it 'opts out of terms of service' do
User::ENFORCE_TOS = false
const_reassign(User, :ENFORCE_TOS, false)
results = Users::Create.run(email: "xyz@qwerty.io",
name: "Faker",
password: "password12345",

View File

@ -48,21 +48,10 @@ RSpec.configure do |config|
end
end
end
puts "rspec pid: #{Process.pid}"
trap 'USR1' do
threads = Thread.list
puts
puts "=" * 80
puts "Received USR1 signal; printing all #{threads.count} thread backtraces."
threads.each do |thr|
description = thr == Thread.main ? "Main thread" : thr.inspect
puts
puts "#{description} backtrace: "
puts thr.backtrace.join("\n")
end
puts "=" * 80
# Reassign constants without getting a bunch of warnings to STDOUT.
# This is just for testing purposes, so NBD.
def const_reassign(target, const, value)
target.send(:remove_const, const)
target.const_set(const, value)
end