|
|
|
|
@ -1,18 +1,18 @@
|
|
|
|
|
require 'simplecov'
|
|
|
|
|
require "simplecov"
|
|
|
|
|
SimpleCov.start do
|
|
|
|
|
add_filter '/app/models/legacy'
|
|
|
|
|
add_filter '/app/views/legacy'
|
|
|
|
|
add_filter '/app/controllers/legacy'
|
|
|
|
|
add_filter '/spec/models/legacy'
|
|
|
|
|
add_filter '/spec/views/legacy'
|
|
|
|
|
add_filter '/spec/controllers/legacy'
|
|
|
|
|
add_filter '/app/helpers/schedules_helper.rb'
|
|
|
|
|
add_filter '/lib/tasks/survey.rake'
|
|
|
|
|
add_filter '/spec/lib/tasks/survey_rake_spec.rb'
|
|
|
|
|
add_filter "/app/models/legacy"
|
|
|
|
|
add_filter "/app/views/legacy"
|
|
|
|
|
add_filter "/app/controllers/legacy"
|
|
|
|
|
add_filter "/spec/models/legacy"
|
|
|
|
|
add_filter "/spec/views/legacy"
|
|
|
|
|
add_filter "/spec/controllers/legacy"
|
|
|
|
|
add_filter "/app/helpers/schedules_helper.rb"
|
|
|
|
|
add_filter "/lib/tasks/survey.rake"
|
|
|
|
|
add_filter "/spec/lib/tasks/survey_rake_spec.rb"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
require 'capybara/rspec'
|
|
|
|
|
require 'capybara/apparition'
|
|
|
|
|
require "capybara/rspec"
|
|
|
|
|
require "capybara/apparition"
|
|
|
|
|
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
|
|
|
|
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
|
|
|
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
|
|
|
|
@ -68,7 +68,7 @@ RSpec.configure do |config|
|
|
|
|
|
config.include Capybara::DSL
|
|
|
|
|
|
|
|
|
|
config.before(:each, type: :system) do
|
|
|
|
|
driven_by :rack_test
|
|
|
|
|
driven_by :apparition
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
config.before(:each, js: true) do
|
|
|
|
|
@ -89,7 +89,7 @@ RSpec.configure do |config|
|
|
|
|
|
# # Allows RSpec to persist some state between runs in order to support
|
|
|
|
|
# # the `--only-failures` and `--next-failure` CLI options. We recommend
|
|
|
|
|
# # you configure your source control system to ignore this file.
|
|
|
|
|
config.example_status_persistence_file_path = 'spec/examples.txt'
|
|
|
|
|
config.example_status_persistence_file_path = "spec/examples.txt"
|
|
|
|
|
#
|
|
|
|
|
# # Limits the available syntax to the non-monkey patched syntax that is
|
|
|
|
|
# # recommended. For more details, see:
|
|
|
|
|
@ -126,7 +126,7 @@ RSpec.configure do |config|
|
|
|
|
|
# Kernel.srand config.seed
|
|
|
|
|
|
|
|
|
|
config.before(:each) do
|
|
|
|
|
stub_const('Twilio::REST::Client', FakeSMS)
|
|
|
|
|
stub_const("Twilio::REST::Client", FakeSMS)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
config.after(:each) do
|
|
|
|
|
@ -134,14 +134,15 @@ RSpec.configure do |config|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
require 'active_support/all'
|
|
|
|
|
require "active_support/all"
|
|
|
|
|
class FakeSMS
|
|
|
|
|
Message = Struct.new(:from, :to, :body)
|
|
|
|
|
|
|
|
|
|
cattr_accessor :messages
|
|
|
|
|
self.messages = []
|
|
|
|
|
|
|
|
|
|
def initialize(_account_sid, _auth_token); end
|
|
|
|
|
def initialize(_account_sid, _auth_token)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def self.reset
|
|
|
|
|
self.messages = []
|
|
|
|
|
@ -158,7 +159,7 @@ class FakeSMS
|
|
|
|
|
|
|
|
|
|
def get(sid)
|
|
|
|
|
phone = self.class.messages[sid].to
|
|
|
|
|
phone = "+1#{phone}" unless phone.starts_with?('+1')
|
|
|
|
|
phone = "+1#{phone}" unless phone.starts_with?("+1")
|
|
|
|
|
Struct.new(:to).new(phone)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
@ -168,7 +169,7 @@ def create_recipients(school, count)
|
|
|
|
|
count.times do |i|
|
|
|
|
|
recipients << school.recipients.create(
|
|
|
|
|
name: "Person#{i}",
|
|
|
|
|
phone: '+' + (i.to_s * 10)
|
|
|
|
|
phone: "+" + (i.to_s * 10)
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
recipients
|
|
|
|
|
|