source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/system/users/passwords_spec.rb
Ruby
mit
47
develop
873
require "rails_helper" RSpec.describe "Passwords" do it "user can reset his password" do user = create(:user, email: "user@example.com") set_app_host(user.account) visit(new_user_session_path) click_on "Forgot your password?" expect(page).to have_title("Forgot your password?") fill_in("Ema...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/lib/state_machine/machine_spec.rb
Ruby
mit
47
develop
1,550
require "rails_helper" module StateMachine RSpec.describe Machine do it "handles state transitions" do state_machine_definition = Class.new(Machine) do state :pending, initial: true, transitions_to: :queued state :queued, transitions_to: [ :running, :errored ] state :errored, transi...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/lib/somleng/client_spec.rb
Ruby
mit
47
develop
775
require "rails_helper" module Somleng RSpec.describe Client do it "can create calls" do client = Client.new(account_sid: "account-sid", auth_token: "auth-token") stub_request(:post, %r{https://api.somleng.org}) client.create_call( to: "+855715100876", from: "1294", url:...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/delivery_attempt_spec.rb
Ruby
mit
47
develop
404
require "rails_helper" RSpec.describe DeliveryAttempt do describe "locking" do it "prevents stale delivery attempts from being updated" do delivery_attempt1 = create(:delivery_attempt) delivery_attempt2 = DeliveryAttempt.find(delivery_attempt1.id) delivery_attempt1.touch expect { deliver...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/notification_spec.rb
Ruby
mit
47
develop
289
require "rails_helper" RSpec.describe Notification do it "sets defaults" do beneficiary = create(:beneficiary) notification = build(:notification, beneficiary: beneficiary) notification.save! expect(notification.phone_number).to eq(beneficiary.phone_number) end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/beneficiary_group_membership_spec.rb
Ruby
mit
47
develop
403
require "rails_helper" RSpec.describe BeneficiaryGroupMembership do it "validates the beneficiary and group belong to the same account" do beneficiary_group = create(:beneficiary_group) beneficiary = create(:beneficiary) group = build(:beneficiary_group_membership, beneficiary_group:, beneficiary:) ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/filter_field_spec.rb
Ruby
mit
47
develop
5,530
require "rails_helper" RSpec.describe FilterField, type: :model do describe "#to_query" do it "handles `eq` operator" do result = FilterField.new( field_definition: find_field_definition("gender"), operator: "eq", value: "M" ).to_query expect(result.to_sql).to eq(Benefi...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/filter_scope_query_spec.rb
Ruby
mit
47
develop
1,196
require "rails_helper" RSpec.describe FilterScopeQuery, type: :model do it "handles relationships without an association" do beneficiary_with_address = create(:beneficiary) create(:beneficiary_address, beneficiary: beneficiary_with_address) beneficiary_without_address = create(:beneficiary) filter_f...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/stats_query_spec.rb
Ruby
mit
47
develop
3,445
require "rails_helper" RSpec.describe StatsQuery, type: :model do it "return results with a simple group by field" do create_list(:beneficiary, 2, gender: "M") create_list(:beneficiary, 3, gender: "F") result = StatsQuery.new( group_by_fields: [ FieldDefinitions::BeneficiaryFields.find_by!...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/broadcast_spec.rb
Ruby
mit
47
develop
362
require "rails_helper" RSpec.describe Broadcast do it "validates the number of beneficiary groups" do broadcast = build(:broadcast) broadcast.beneficiary_groups = 11.times.map { build(:beneficiary_group, account: broadcast.account) } expect(broadcast.valid?).to be(false) expect(broadcast.errors[:ben...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/dashboard_summary_spec.rb
Ruby
mit
47
develop
3,608
require "rails_helper" RSpec.describe DashboardSummary do describe DashboardSummary::Stats do describe "#total_count" do it "returns the total number of items" do account = create(:account) create_list(:beneficiary, 2, account:) db_analyze stats = DashboardSummary::Stats.ne...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/beneficiary_address_spec.rb
Ruby
mit
47
develop
498
require "rails_helper" RSpec.describe BeneficiaryAddress do it "validates the address" do expect( build( :beneficiary_address, iso_region_code: "KH-1", administrative_division_level_2_code: "0101", administrative_division_level_3_code: "010101" ) ).to be_valid ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/broadcast_summary_spec.rb
Ruby
mit
47
develop
1,855
require "rails_helper" RSpec.describe BroadcastSummary do describe "#notifications_count" do it "returns the number of notifications" do broadcast = create(:broadcast) create(:notification, broadcast:) broadcast_summary = BroadcastSummary.new(broadcast) result = broadcast_summary.notific...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/broadcast_preview_spec.rb
Ruby
mit
47
develop
1,021
require "rails_helper" RSpec.describe BroadcastPreview do it "preview a broadcast" do account = create(:account) beneficiary = create(:beneficiary, account:, gender: "F") create(:beneficiary, :disabled, account:, gender: "F") beneficiary_in_group = create(:beneficiary, account:, gender: "M") bene...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/delivery_attempt_status_update_spec.rb
Ruby
mit
47
develop
1,644
require "rails_helper" RSpec.describe DeliveryAttemptStatusUpdate do it "returns the desired status" do expect(DeliveryAttemptStatusUpdate.new(channel: "voice", status: "queued").desired_status).to be_nil expect(DeliveryAttemptStatusUpdate.new(channel: "voice", status: "ringing").desired_status).to be_nil ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/account_spec.rb
Ruby
mit
47
develop
273
require "rails_helper" RSpec.describe Account do it "sets the defaults" do account = build(:account) account.save! expect(account).to have_attributes( delivery_attempt_queue_limit: 200, max_delivery_attempts_for_notification: 3 ) end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/broadcast_beneficiary_groups_spec.rb
Ruby
mit
47
develop
471
require "rails_helper" RSpec.describe BroadcastBeneficiaryGroup do it "validates the broadcast and beneficiary group belong to the same account" do broadcast = create(:broadcast) beneficiary_group = create(:beneficiary_group) broadcast_beneficiary_group = build(:broadcast_beneficiary_group, broadcast:, b...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/query_cache_spec.rb
Ruby
mit
47
develop
1,770
require "rails_helper" RSpec.describe QueryCache do it "handles basic query caching" do cache = QueryCache.new(store: build_cache_store) cache_misses = 0 params = { foo: "bar" } 2.times do cache.fetch(params) do cache_misses += 1 end end expect(cache_misses).to eq(1) e...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/field_definitions/filter_schema/string_type_spec.rb
Ruby
mit
47
develop
2,718
require "rails_helper" RSpec.describe FieldDefinitions::FilterSchema::StringType do it "supports `eq` operator" do schema = build_schema expect(validate_schema(schema, input: { eq: "foo" })).to be_success expect(validate_schema(schema, input: { eq: nil })).not_to be_success end it "supports `not_eq...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/field_definitions/filter_schema/value_type_spec.rb
Ruby
mit
47
develop
2,529
require "rails_helper" RSpec.describe FieldDefinitions::FilterSchema::ValueType do it "supports `eq` operator" do schema = build_schema expect(validate_schema(schema, input: { eq: 1 })).to be_success expect(validate_schema(schema, input: { eq: nil })).not_to be_success end it "supports `not_eq` ope...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/field_definitions/filter_schema/list_type_spec.rb
Ruby
mit
47
develop
2,195
require "rails_helper" RSpec.describe FieldDefinitions::FilterSchema::ListType do it "supports `eq` operator" do schema = build_schema(options: [ "foo", "bar" ]) expect(validate_schema(schema, input: { eq: "foo" })).to be_success expect(validate_schema(schema, input: { eq: nil })).not_to be_success ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/country_address_data/np_spec.rb
Ruby
mit
47
develop
784
require "rails_helper" RSpec.describe CountryAddressData::NP do it "returns address localities in Nepal" do result = CountryAddressData::NP.address_data expect(result).to be_an(Array) expect(result[0]).to be_a(CountryAddressData::Locality) first_province = Gaun::Province.all.first expect(result...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/country_address_data/la_spec.rb
Ruby
mit
47
develop
783
require "rails_helper" RSpec.describe CountryAddressData::LA do it "returns address localities in Laos" do result = CountryAddressData::LA.address_data expect(result).to be_an(Array) expect(result[0]).to be_a(CountryAddressData::Locality) first_province = Baan::Province.all.first expect(result[...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/models/concerns/approximate_count_spec.rb
Ruby
mit
47
develop
671
require "rails_helper" RSpec.describe ApproximateCount do describe ".approximate_count" do it "returns approximate count without filters" do create_list(:beneficiary, 20) db_analyze count = Beneficiary.approximate_count expect(count).to eq(20) end it "returns approximate count ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/decorators/broadcast_decorator_spec.rb
Ruby
mit
47
develop
1,587
require "rails_helper" RSpec.describe BroadcastDecorator, type: :decorator do describe "#notification_stats" do it "returns a hash with counts for each status" do broadcast = create(:broadcast) create(:notification, :failed, broadcast:) create(:notification, :failed, broadcast:) create(:n...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/db/application_seeder_spec.rb
Ruby
mit
47
develop
609
require "rails_helper" require Rails.root.join("db/application_seeder") RSpec.describe ApplicationSeeder do it "seeds the database" do seeder = ApplicationSeeder.new seeder.seed! expect(Account.count).to eq(1) expect(Account.first).to have_attributes( api_key: be_present, users: contain...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/forms/account_form_spec.rb
Ruby
mit
47
develop
700
require "rails_helper" RSpec.describe AccountForm do it "saves the form" do account = create(:account, :with_logo, subdomain: "my-account") form = AccountForm.new( object: account, name: "My account", country: "KH", logo: nil, somleng_account_sid: "", somleng_auth_token: "...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/forms/export_form_spec.rb
Ruby
mit
47
develop
1,442
require "rails_helper" RSpec.describe ExportForm, type: :model do it "creates an export" do user = create(:user) result = ExportForm.new( user: user, resource_type: "Broadcast", filter_params: { status: { operator: "eq", value: "pending" } } )....
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/forms/filter_form_spec.rb
Ruby
mit
47
develop
437
require "rails_helper" RSpec.describe FilterForm do it "applies the filter to the scope" do pending_broadcast = create(:broadcast, :pending) _completed_broadcast = create(:broadcast, :completed) result = BroadcastFilterForm.new( status: { operator: "eq", value: "pending" } ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/forms/broadcast_form_spec.rb
Ruby
mit
47
develop
3,025
require "rails_helper" RSpec.describe BroadcastForm do it "handles initialization" do broadcast = create( :broadcast, channel: :voice, beneficiary_filter: { gender: { eq: "M" }, "address.iso_region_code": { eq: "KH-1" } }, ) form = BroadcastForm.initialize_with(br...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/create_beneficiary_import_template_spec.rb
Ruby
mit
47
develop
680
require "rails_helper" RSpec.describe CreateBeneficiaryImportTemplate do it "creates a new import template" do template = Pathname(Rails.root.join("app", "assets", "files", "beneficiary_import_template.csv")) CreateBeneficiaryImportTemplate.call(template:) result = CSV.read(template, headers: true) ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/create_beneficiary_spec.rb
Ruby
mit
47
develop
1,914
require "rails_helper" RSpec.describe CreateBeneficiary do it "creates a beneficiary" do account = create(:account) beneficiary = CreateBeneficiary.call( account:, phone_number: "+85510999999", iso_country_code: "KH", ) expect(beneficiary).to have_attributes( phone_number: "...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/update_broadcast_spec.rb
Ruby
mit
47
develop
1,131
require "rails_helper" RSpec.describe UpdateBroadcast do it "updates the broadcast" do broadcast = create(:broadcast, :pending) UpdateBroadcast.call(broadcast, desired_status: :queued) expect(broadcast).to have_attributes(status: "queued") end it "sets started by" do broadcast = create(:broadc...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/delete_beneficiary_spec.rb
Ruby
mit
47
develop
557
require "rails_helper" RSpec.describe DeleteBeneficiary do it "deletes a beneficiary" do account = create(:account) beneficiary = create(:beneficiary, account:) DeleteBeneficiary.call(beneficiary) expect(account.events).to contain_exactly( have_attributes( type: "beneficiary.deleted",...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/import_csv_spec.rb
Ruby
mit
47
develop
567
require "rails_helper" RSpec.describe ImportCSV do it "imports a CSV" do import = create( :import, :beneficiaries ) ImportCSV.call(import) expect(import).to have_attributes( status: "succeeded" ) end it "handles invalid CSVs" do import = create( :import, :...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/export_csv_spec.rb
Ruby
mit
47
develop
2,767
require "rails_helper" RSpec.describe ExportCSV do describe "#call" do context "when exporting with filter params" do it "exports only records matching the filter criteria" do user = create(:user) account = user.account _pending_broadcast = create(:broadcast, :pending, account: acc...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/import_beneficiary_spec.rb
Ruby
mit
47
develop
7,495
require "rails_helper" RSpec.describe ImportBeneficiary do it "imports a beneficiary" do import = create(:import, :beneficiaries) beneficiary = ImportBeneficiary.call( import:, data: { phone_number: "85516789111", iso_country_code: "KH" } ) expect(beneficiary).to h...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/update_delivery_attempt_spec.rb
Ruby
mit
47
develop
1,216
require "rails_helper" RSpec.describe UpdateDeliveryAttempt do it "sets the metadata" do delivery_attempt = create(:delivery_attempt) somleng_resource = build_somleng_resource(call_duration: 87, status: "completed", sip_response_code: "200") UpdateDeliveryAttempt.call(delivery_attempt, somleng_resource:...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/start_broadcast_spec.rb
Ruby
mit
47
develop
6,800
require "rails_helper" RSpec.describe StartBroadcast do it "starts a broadcast" do account = create(:account, :configured_for_broadcasts) create(:beneficiary, account:, gender: "M") female_beneficiaries = create_list(:beneficiary, 3, account:, gender: "F") female_beneficiaries.first(2).each do |benef...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/handle_delivery_attempt_status_update_spec.rb
Ruby
mit
47
develop
4,791
require "rails_helper" RSpec.describe HandleDeliveryAttemptStatusUpdate do it "handles completed events" do broadcast = create(:broadcast, :running) notification = create(:notification, :pending, broadcast:) delivery_attempt = create(:delivery_attempt, :initiated, notification:) HandleDeliveryAttemp...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/workflows/copy_blob_with_extension_spec.rb
Ruby
mit
47
develop
589
require "rails_helper" RSpec.describe CopyBlobWithExtension do it "copies the blob with adding the file extension" do blob = create(:active_storage_attachment, filename: "test.mp3") client = Aws::S3::Client.new(stub_responses: true) CopyBlobWithExtension.call(blob, bucket: "my-bucket", client:) exp...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/route_constraints/app_subdomain_constraint_spec.rb
Ruby
mit
47
develop
726
require "rails_helper" RSpec.describe AppSubdomainConstraint do it "handles handles app subdomains" do create(:account, subdomain: "foobar") constraint = AppSubdomainConstraint.new request = stub_request( "HTTP_HOST" => "foobar.app.open-ews.org" ) result = constraint.matches?(request) ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/types/form_data_type_spec.rb
Ruby
mit
47
develop
391
require "rails_helper" RSpec.describe FormDataType do it "handles form data" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :my_attribute, FormDataType.new end expect(klass.new(my_attribute: "").my_attribute).to be_nil expect(klass.new...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/types/phone_number_type_spec.rb
Ruby
mit
47
develop
506
require "rails_helper" RSpec.describe PhoneNumberType do it "handles phone number types" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :number, PhoneNumberType.new end expect(klass.new(number: nil).number).to eq(nil) expect(klass.new(...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/types/filter_data_type_spec.rb
Ruby
mit
47
develop
1,146
require "rails_helper" RSpec.describe FilterDataType do it "handles filter data types" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :filter_data, FilterDataType.new(field_definitions: FieldDefinitions::BeneficiaryFields) end expect(klass...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/helpers/application_helper_spec.rb
Ruby
mit
47
develop
3,233
require 'rails_helper' RSpec.describe ApplicationHelper do describe '#flash_class' do it 'returns flash alert class name based on given type' do expect(helper.flash_class('notice')).to eq 'alert alert-info' expect(helper.flash_class('success')).to eq 'alert alert-success' expect(helper.flash_cl...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_documentation_client.rb
Ruby
mit
47
develop
275
class APIDocumentationClient < RspecApiDocumentation::RackTestClient private # https://github.com/zipmark/rspec_api_documentation/pull/543/files def read_request_body input = last_request.env["rack.input"] || StringIO.new input.rewind input.read end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/rspec_api_documentation_client.rb
Ruby
mit
47
develop
689
class APIDocumentationClient < RspecApiDocumentation::RackTestClient private def process(method, path, params = {}, headers = {}) if path.start_with?("http") full_path = path else full_path = URI.join("https://api.open-ews.org", path) end do_request(method, full_path, params, headers) ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/request_spec_helpers.rb
Ruby
mit
47
develop
645
module RequestSpecHelpers def set_authorization_header_for(account) access_token = create(:access_token, account:) set_authorization_header(access_token:) end def set_authorization_header(access_token:) authentication :basic, "Bearer #{access_token.token}" end def json_response(body = response_b...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/request_schema_matchers.rb
Ruby
mit
47
develop
1,024
module RequestSchemaMatchers extend RSpec::Matchers::DSL module Helpers def valid?(actual, *path) actual.errors.to_h.dig(*path).blank? end def invalid?(actual, *path) options = path.extract_options! errors = actual.errors.to_h.dig(*path) return false if errors.blank? retu...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/open_ews_slate_example.rb
Ruby
mit
47
develop
391
class OpenEWSSlateExample < RspecApiDocumentation::Views::SlateExample def initialize(example, configuration) super self.template_path = File.expand_path(__dir__) end def requests super.map do |hash| hash[:request_query_parameters_text] = JSON.pretty_generate(hash[:request_query_parameters]) if...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/rspec_api_documentation.rb
Ruby
mit
47
develop
6,859
require "rspec_api_documentation/dsl" RspecApiDocumentation.configure do |config| config.api_name = "OpenEWS API Documentation" config.api_explanation = <<~HEREDOC # Introduction The OpenEWS API enables Organizations and Governments to efficiently manage and disseminate early warning broadcasts to benefic...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/aws.rb
Ruby
mit
47
develop
206
require "aws-sdk-s3" ENV["AWS_DEFAULT_REGION"] ||= "ap-southeast-1" ENV["AWS_ACCESS_KEY_ID"] ||= "access-key-id" ENV["AWS_SECRET_ACCESS_KEY"] ||= "secret-key" Aws.config[:s3] ||= { stub_responses: true }
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/capybara.rb
Ruby
mit
47
develop
534
require "selenium/webdriver" RSpec.configure do |config| config.before(:each, type: :system) do driven_by :rack_test Capybara.app_host = AppSettings.fetch(:app_url_host) Capybara.server = :puma, { Silent: true } Capybara.disable_animation = true end config.before(:each, :js, type: :system) do ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/system_spec_helpers.rb
Ruby
mit
47
develop
1,472
module SystemSpecHelpers def account_sign_in(user) set_app_host(user.account) sign_in(user) end def set_app_host(account) Capybara.app_host = "http://#{account.subdomain_host}" end def have_image(alt:) have_css("img[alt='#{alt}']") end def have_content_tag_for(model, model_name: nil) ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_response_schema_matchers.rb
Ruby
mit
47
develop
3,910
RSpec::Matchers.define :match_api_response_schema do |schema_name| match do |response_body| @validator = APIResponseSchemaValidator.new(response_body, schema_name) @validator.valid_response? end failure_message do @validator.errors end end RSpec::Matchers.define :match_api_response_collection_sche...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_response_schemas/account_schema.rb
Ruby
mit
47
develop
293
module APIResponseSchema AccountSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "account") required(:attributes).schema do required(:somleng_account_sid).maybe(:str?) required(:somleng_auth_token).maybe(:str?) end end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_response_schemas/beneficiary_group_schema.rb
Ruby
mit
47
develop
380
module APIResponseSchema BeneficiaryGroupSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "beneficiary_group") required(:attributes).schema do required(:name).filled(:str?) end required(:relationships).schema do required(:members).schema do ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_response_schemas/event_schema.rb
Ruby
mit
47
develop
310
module APIResponseSchema EventSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "event") required(:attributes).schema do required(:type).filled(:str?) required(:created_at).filled(:str?) required(:updated_at).filled(:str?) end end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_response_schemas/stat_schema.rb
Ruby
mit
47
develop
227
module APIResponseSchema StatSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "stat") required(:attributes).schema do required(:result).filled(:hash?) end end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_response_schemas/beneficiary_schema.rb
Ruby
mit
47
develop
801
module APIResponseSchema BeneficiarySchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "beneficiary") required(:attributes).schema do required(:phone_number).filled(:str?) required(:status).filled(:str?) required(:disability_status).maybe(:str?) ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_response_schemas/broadcast_schema.rb
Ruby
mit
47
develop
744
module APIResponseSchema BroadcastSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "broadcast") required(:attributes).schema do required(:name).maybe(:str?) required(:channel).maybe(:str?) required(:audio_url).maybe(:str?) required(:message).ma...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_response_schemas/notification_schema.rb
Ruby
mit
47
develop
647
module APIResponseSchema NotificationSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "notification") required(:attributes).schema do required(:phone_number).filled(:str?) required(:status).filled(:str?) required(:delivery_attempts_count).filled(:int...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/support/api_response_schemas/beneficiary_address_schema.rb
Ruby
mit
47
develop
750
module APIResponseSchema BeneficiaryAddressSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "beneficiary_address") required(:attributes).schema do required(:iso_region_code).filled(:str?) required(:administrative_division_level_2_name).maybe(:str?) r...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/jobs/retry_notification_job_spec.rb
Ruby
mit
47
develop
1,362
require "rails_helper" RSpec.describe RetryNotificationJob do it "retries an notification" do notification = create(:notification, :pending) delivery_attempt = create(:delivery_attempt, :failed, notification:) RetryNotificationJob.perform_now(notification) expect(notification.delivery_attempts).to ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/jobs/initiate_delivery_attempt_job_spec.rb
Ruby
mit
47
develop
4,156
require "rails_helper" RSpec.describe InitiateDeliveryAttemptJob do describe "#perform" do it "initiates a voice delivery attempt" do account = create( :account, notification_phone_number: "1294", somleng_account_sid: "account-sid", somleng_auth_token: "auth-token" ) ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/jobs/update_delivery_attempt_status_job_spec.rb
Ruby
mit
47
develop
2,735
require "rails_helper" RSpec.describe UpdateDeliveryAttemptStatusJob do it "updates the status of a voice delivery attempt" do account = create(:account) broadcast = create(:broadcast, :running, :voice, account:) notification = create(:notification, broadcast:) delivery_attempt = create( :deliv...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
spec/jobs/scheduled_job_spec.rb
Ruby
mit
47
develop
3,461
require "rails_helper" RSpec.describe ScheduledJob do it "initializes delivery attempts" do account = create(:account, delivery_attempt_queue_limit: 1) low_priority_delivery_attempt = create( :delivery_attempt, notification: create( :notification, broadcast: create(:broadcast, :r...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/schema.rb
Ruby
mit
47
develop
18,578
# This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/application_seeder.rb
Ruby
mit
47
develop
1,595
class ApplicationSeeder USER_PASSWORD = "OpenEWS1234!".freeze USER_EMAIL = "user@example.com".freeze ACCOUNT_NAME = "My Alerting Authority".freeze ACCOUNT_SUBDOMAIN = ACCOUNT_NAME.parameterize.freeze ACCOUNT_COUNTRY = "KH".freeze def seed! account = Account.first_or_create!( name: ACCOUNT_NAME, ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20170926070448_create_callout_participations.rb
Ruby
mit
47
develop
687
class CreateCalloutParticipations < ActiveRecord::Migration[5.1] def change create_table :callout_participations do |t| t.references(:callout, foreign_key: true, index: true, null: false) t.references(:contact, foreign_key: true, index: true, null: false) t.references( :callout_populatio...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250114071442_add_beneficiary_addresses_indexes.rb
Ruby
mit
47
develop
477
class AddBeneficiaryAddressesIndexes < ActiveRecord::Migration[8.0] def change add_index :beneficiary_addresses, [ :beneficiary_id, :iso_region_code, :administrative_division_level_2_code, :administrative_division_level_3_code, :administrative_division_level_4_code ] add_index :beneficiary_addresses, [ :benef...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20171101092942_create_remote_phone_call_events.rb
Ruby
mit
47
develop
483
class CreateRemotePhoneCallEvents < ActiveRecord::Migration[5.1] def change create_table :remote_phone_call_events do |t| t.references(:phone_call, null: false, index: true, foreign_key: true) t.jsonb(:details, null: false, default: {}) t.jsonb(:metadata, null: false, default: {}) t.string...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250409101850_remove_unused_columns_from_delivery_attempts.rb
Ruby
mit
47
develop
507
class RemoveUnusedColumnsFromDeliveryAttempts < ActiveRecord::Migration[8.0] def change change_column_null(:delivery_attempts, :alert_id, false) change_column_null(:delivery_attempts, :broadcast_id, false) remove_column(:delivery_attempts, :remote_call_id, :string) remove_column(:delivery_attempts, :r...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250524064349_change_iso_language_code_to_citext.rb
Ruby
mit
47
develop
311
class ChangeISOLanguageCodeToCitext < ActiveRecord::Migration[8.0] def change reversible do |dir| dir.up do change_column(:beneficiaries, :iso_language_code, :citext) end dir.down do change_column(:beneficiaries, :iso_language_code, :string) end end end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250531055239_remove_created_by_reference_from_oauth_access_tokens.rb
Ruby
mit
47
develop
212
class RemoveCreatedByReferenceFromOauthAccessTokens < ActiveRecord::Migration[8.0] def change remove_reference :oauth_access_tokens, :created_by, foreign_key: { to_table: :accounts }, null: false end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20171211072157_create_doorkeeper_tables.rb
Ruby
mit
47
develop
3,008
class CreateDoorkeeperTables < ActiveRecord::Migration[5.1] def change create_table :oauth_applications do |t| t.references( :owner, foreign_key: { to_table: :accounts }, null: false ) t.string :name, null: false t.string :uid, ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250211084958_rename_callouts_to_broadcasts.rb
Ruby
mit
47
develop
321
class RenameCalloutsToBroadcasts < ActiveRecord::Migration[8.0] def change rename_table :callouts, :broadcasts rename_column :phone_calls, :callout_id, :broadcast_id rename_column :batch_operations, :callout_id, :broadcast_id rename_column :callout_participations, :callout_id, :broadcast_id end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20171211071319_create_accounts.rb
Ruby
mit
47
develop
536
class CreateAccounts < ActiveRecord::Migration[5.1] def change create_table :accounts do |t| t.jsonb(:metadata, null: false, default: {}) t.jsonb(:settings, null: false, default: {}) t.string(:twilio_account_sid) t.string(:somleng_account_sid) t.string(:twilio_auth_token) t.str...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20171212123107_add_account_id_to_contacts.rb
Ruby
mit
47
develop
256
class AddAccountIdToContacts < ActiveRecord::Migration[5.1] def up change_table(:contacts) do |t| t.references(:account, index: true, foreign_key: true, null: false) end end def down remove_reference(:contacts, :account) end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250107072933_add_iso_country_code_to_beneficiary_addresses.rb
Ruby
mit
47
develop
1,034
class AddISOCountryCodeToBeneficiaryAddresses < ActiveRecord::Migration[8.0] def change change_column_null :beneficiary_addresses, :iso_region_code, false add_column :beneficiary_addresses, :iso_country_code, :citext, null: false remove_index :beneficiary_addresses, [ :iso_region_code, :administrative_di...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250127074839_add_beneficiary_filter_and_channel_to_callouts.rb
Ruby
mit
47
develop
238
class AddBeneficiaryFilterAndChannelToCallouts < ActiveRecord::Migration[8.0] def change add_column :callouts, :channel, :string, null: false add_column :callouts, :beneficiary_filter, :jsonb, null: false, default: {} end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250513055901_create_imports.rb
Ruby
mit
47
develop
399
class CreateImports < ActiveRecord::Migration[8.0] def change create_table :imports do |t| t.string :resource_type, null: false t.string :status, null: false t.string :error_message t.references :user, null: false, foreign_key: { on_delete: :cascade } t.references :account, null: fal...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250213090508_rename_callout_participations_to_alerts.rb
Ruby
mit
47
develop
215
class RenameCalloutParticipationsToAlerts < ActiveRecord::Migration[8.0] def change rename_table :callout_participations, :alerts rename_column :phone_calls, :callout_participation_id, :alert_id end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20170926070440_create_callouts.rb
Ruby
mit
47
develop
257
class CreateCallouts < ActiveRecord::Migration[5.1] def change create_table :callouts do |t| t.string(:status, null: false) t.string(:call_flow_logic) t.jsonb(:metadata, null: false, default: {}) t.timestamps end end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20170926070445_create_contacts.rb
Ruby
mit
47
develop
261
class CreateContacts < ActiveRecord::Migration[5.1] def change create_table :contacts do |t| t.string(:msisdn, null: false) t.jsonb(:metadata, null: false, default: {}) t.index(:msisdn, unique: true) t.timestamps end end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250410155842_create_beneficiary_group_memberships.rb
Ruby
mit
47
develop
481
class CreateBeneficiaryGroupMemberships < ActiveRecord::Migration[8.0] def change create_table :beneficiary_group_memberships do |t| t.references :beneficiary, null: false, foreign_key: { on_delete: :cascade }, index: false t.references :beneficiary_group, null: false, foreign_key: { on_delete: :casca...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250407041312_add_timestamps_to_broadcasts.rb
Ruby
mit
47
develop
351
class AddTimestampsToBroadcasts < ActiveRecord::Migration[8.0] def change add_column(:broadcasts, :started_at, :datetime) add_column(:broadcasts, :completed_at, :datetime) remove_reference(:broadcasts, :created_by, foreign_key: { to_table: :users }) remove_column(:broadcasts, :settings, :jsonb, defau...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20210907151059_add_remote_status_fetch_queued_at_to_phone_calls.rb
Ruby
mit
47
develop
232
class AddRemoteStatusFetchQueuedAtToPhoneCalls < ActiveRecord::Migration[6.1] def change add_column :phone_calls, :remote_status_fetch_queued_at, :datetime add_index(:phone_calls, :remote_status_fetch_queued_at) end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250410155758_create_beneficiary_groups.rb
Ruby
mit
47
develop
268
class CreateBeneficiaryGroups < ActiveRecord::Migration[8.0] def change create_table :beneficiary_groups do |t| t.references :account, null: false, foreign_key: { on_delete: :cascade } t.string :name, null: false t.timestamps end end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20240924112755_change_accounts_twilio_account_sid_and_somleng_account_sid_to_citext.rb
Ruby
mit
47
develop
492
class ChangeAccountsTwilioAccountSidAndSomlengAccountSidToCitext < ActiveRecord::Migration[7.1] def change enable_extension("citext") reversible do |dir| dir.up do change_column(:accounts, :twilio_account_sid, :citext) change_column(:accounts, :somleng_account_sid, :citext) end ...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20171212122854_add_account_id_to_callouts.rb
Ruby
mit
47
develop
256
class AddAccountIdToCallouts < ActiveRecord::Migration[5.1] def up change_table(:callouts) do |t| t.references(:account, index: true, foreign_key: true, null: false) end end def down remove_reference(:callouts, :account) end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250929061539_add_error_code_to_delivery_attempts.rb
Ruby
mit
47
develop
264
class AddErrorCodeToDeliveryAttempts < ActiveRecord::Migration[8.0] def change add_column(:delivery_attempts, :error_code, :string) add_index(:delivery_attempts, [ :error_code, :beneficiary_id ], where: "error_code='phone_number_unreachable'") end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250812132724_add_supported_channels_to_accounts.rb
Ruby
mit
47
develop
303
class AddSupportedChannelsToAccounts < ActiveRecord::Migration[8.0] def change add_column :accounts, :supported_channels, :string, array: true, default: [], null: false reversible do |dir| dir.up do Account.update_all(supported_channels: [ :voice ]) end end end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250121110447_change_beneficiary_phone_number_not_null_on_callout_participations.rb
Ruby
mit
47
develop
200
class ChangeBeneficiaryPhoneNumberNotNullOnCalloutParticipations < ActiveRecord::Migration[8.0] def change change_column_null :callout_participations, :beneficiary_phone_number, false end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20250115084759_add_disability_status_to_beneficiaries.rb
Ruby
mit
47
develop
211
class AddDisabilityStatusToBeneficiaries < ActiveRecord::Migration[8.0] def change add_column :contacts, :disability_status, :string add_index :contacts, [ :account_id, :disability_status ] end end
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20210318081710_add_status_and_retry_count_to_callout_participations.rb
Ruby
mit
47
develop
853
class AddStatusAndRetryCountToCalloutParticipations < ActiveRecord::Migration[6.0] def change add_column :callout_participations, :answered, :boolean, default: false, null: false, index: true add_column :callout_participations, :phone_calls_count, :integer, null: false, default: 0, index: true remove_col...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20170926070754_create_phone_calls.rb
Ruby
mit
47
develop
1,300
class CreatePhoneCalls < ActiveRecord::Migration[5.1] def change create_table :phone_calls do |t| t.references(:callout_participation, index: true, foreign_key: true) t.references(:contact, null: false, index: true, foreign_key: true) t.references( :create_batch_operation, index:...
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20180610233414_create_active_storage_tables.active_storage.rb
Ruby
mit
47
develop
1,074
# This migration comes from active_storage (originally 20170806125915) class CreateActiveStorageTables < ActiveRecord::Migration[5.2] def up return if ActiveRecord::Base.connection.table_exists?(:active_storage_blobs) create_table :active_storage_blobs do |t| t.string :key, null: false t....
github
open-ews/open-ews
https://github.com/open-ews/open-ews
db/migrate/20181112121031_add_unique_index_on_phone_calls_and_participation_state.rb
Ruby
mit
47
develop
234
class AddUniqueIndexOnPhoneCallsAndParticipationState < ActiveRecord::Migration[5.2] def change add_index( :phone_calls, %i[callout_participation_id status], unique: true, where: "status = 'created'" ) end end