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 | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/accounts_spec.rb | Ruby | mit | 95 | develop | 9,590 | require "rails_helper"
RSpec.describe "Accounts" do
it "List and filter accounts", :js do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
create(
:account,
name: "Rocket Rides",
carrier:,
created_at: Time.utc(2021, 12, 1),
metadata: {
"customer" =... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/phone_number_plans_spec.rb | Ruby | mit | 95 | develop | 3,135 | require "rails_helper"
RSpec.describe "Phone Number Plans" do
it "List, filter and export phone number plans" do
carrier = create(:carrier, billing_currency: "USD")
account = create(:account, carrier:, name: "Rocket Rides")
active_plan = create(
:phone_number_plan,
:active,
number: "125... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/sms_gateway_channel_groups_spec.rb | Ruby | mit | 95 | develop | 3,231 | require "rails_helper"
RSpec.describe "SMS Gateway Channel Groups" do
it "List and filter channel groups" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
sms_gateway = create(:sms_gateway, carrier:)
create(
:sms_gateway_channel_group,
sms_gateway:,
name: "Smar... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/account_settings_spec.rb | Ruby | mit | 95 | develop | 1,778 | require "rails_helper"
RSpec.describe "Account Settings" do
it "View account settings", :js do
account = create(:account, :with_access_token, :billing_enabled, name: "Rocket Rides", billing_currency: "USD")
user = create(
:user, :with_account_membership, account_role: :member, account:
)
stub_... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/carrier_users_spec.rb | Ruby | mit | 95 | develop | 3,509 | require "rails_helper"
RSpec.describe "Carrier users" do
it "List and filter users" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
create(:user, :carrier, name: "John Doe", carrier:, created_at: Time.utc(2021, 12, 1))
create(:user, :carrier, name: "Joe Bloggs", carrier:,
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/webhook_request_logs_spec.rb | Ruby | mit | 95 | develop | 1,106 | require "rails_helper"
RSpec.describe "Webhook Request Logs" do
it "List webhook request logs" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
event = create(:event, carrier:)
webhook1 = create(:webhook_request_log, event:, failed: true)
webhook2 = create(:webhook_request_l... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/messages_spec.rb | Ruby | mit | 95 | develop | 3,343 | require "rails_helper"
RSpec.describe "Messages" do
it "List and filter messages" do
carrier = create(:carrier)
account = create(:account, carrier:)
incoming_phone_number = create(:incoming_phone_number, account:)
message = create(
:message,
:sending,
direction: :outbound_api,
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/notification_preferences_spec.rb | Ruby | mit | 95 | develop | 717 | require "rails_helper"
RSpec.describe "Notification settings" do
it "Update notification settings" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
carrier_sign_in(user)
visit(dashboard_root_path)
click_on("Profile Menu")
click_on("Notifications")
check("Inbound m... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/carrier_dashboard_spec.rb | Ruby | mit | 95 | develop | 309 | require "rails_helper"
RSpec.describe "Carrier Dashboard" do
it "displays account trial info" do
carrier = create(:carrier, :restricted)
user = create(:user, :carrier, carrier:)
carrier_sign_in(user)
visit dashboard_root_path
expect(page).to have_content("Account (Trial)")
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/phone_calls_spec.rb | Ruby | mit | 95 | develop | 4,136 | require "rails_helper"
RSpec.describe "Phone Calls" do
it "List and filter phone calls" do
carrier = create(:carrier)
account = create(:account, carrier:)
incoming_phone_number = create(:incoming_phone_number, account:)
phone_call = create(
:phone_call,
:outbound,
account:,
in... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/account_switcher_spec.rb | Ruby | mit | 95 | develop | 964 | require "rails_helper"
RSpec.describe "Account Switcher" do
it "User can switch between accounts", :js do
carrier = create(:carrier)
user = create(:user, name: "John Doe", carrier:)
create_account_membership(user:, carrier:, name: "Rocket Rides", current_membership: true)
create_account_membership(us... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/phone_numbers_spec.rb | Ruby | mit | 95 | develop | 9,732 | require "rails_helper"
RSpec.describe "Phone Numbers" do
it "List, filter and bulk delete phone numbers" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
common_attributes = {
carrier:,
iso_country_code: "US",
type: :local,
created_at: Time.utc(2024, 4, 27),... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/account_memberships_spec.rb | Ruby | mit | 95 | develop | 4,436 | require "rails_helper"
RSpec.describe "Account Memberships" do
it "List account memberships" do
carrier = create(:carrier)
account = create(:account, carrier:)
other_account = create(:account, carrier:)
user = create(
:user, :with_account_membership, account_role: :owner, account:, name: "Joe B... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/tts_events_spec.rb | Ruby | mit | 95 | develop | 1,629 | require "rails_helper"
RSpec.describe "TTS Events" do
it "List and filter TTS Events" do
tts_event = create(:tts_event)
other_tts_event = create(:tts_event, carrier: tts_event.carrier)
user = create(:user, :carrier, carrier: tts_event.carrier)
carrier_sign_in(user)
visit dashboard_tts_events_pat... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/incoming_phone_numbers_spec.rb | Ruby | mit | 95 | develop | 7,302 | require "rails_helper"
RSpec.describe "Incoming Phone Numbers" do
it "List and filter incoming numbers" do
carrier = create(:carrier)
account = create(:account, :carrier_managed, carrier:, name: "My Carrier Account")
customer_managed_account = create(:account, :customer_managed, carrier:)
incoming_ph... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/sms_gateways_spec.rb | Ruby | mit | 95 | develop | 2,895 | require "rails_helper"
RSpec.describe "SMS Gateways" do
it "List and filter SMS Gateways" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
create(
:sms_gateway,
carrier:,
name: "Main SMS Gateway"
)
create(
:sms_gateway,
carrier:,
name: "Ol... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/balance_transactions_spec.rb | Ruby | mit | 95 | develop | 3,694 | require "rails_helper"
RSpec.describe "Balance Transactions" do
it "List and filter balance transactions" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
account = create(:account, carrier:)
balance_transaction = create(
:balance_transaction,
:for_phone_call,
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/user_profile_spec.rb | Ruby | mit | 95 | develop | 1,328 | require "rails_helper"
RSpec.describe "User profile" do
it "Update user profile" do
carrier = create(:carrier)
user = create(
:user,
:carrier,
carrier:, name: "John Doe",
email: "johndoe@example.com",
password: "current password"
)
carrier_sign_in(user)
visit(dashbo... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/verifications_spec.rb | Ruby | mit | 95 | develop | 2,513 | require "rails_helper"
RSpec.describe "Verifications" do
it "List and filter verifications" do
verification_service = create(:verification_service)
pending_verification = create(:verification, :pending, verification_service:)
expired_verification = create(:verification, :expired, verification_service:)
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/forgot_subdomain_spec.rb | Ruby | mit | 95 | develop | 643 | require "rails_helper"
RSpec.describe "Forgot subdomain" do
it "Handles forgotten subdomains" do
carrier = create(:carrier, name: "AT&T", subdomain: "at-t")
user = create(:user, :carrier, carrier:, email: "johndoe@att.com")
visit(new_forgot_subdomain_path)
fill_in("Email", with: user.email)
per... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/sign_up_spec.rb | Ruby | mit | 95 | develop | 1,447 | require "rails_helper"
RSpec.describe "Signup" do
it "Sign up as a carrier" do
visit(new_user_registration_path)
fill_in("Your name", with: "John Doe")
fill_in("Work email", with: "johndoe@att.com")
fill_in("Company", with: "AT&T")
fill_in("Subdomain", with: "at-t")
enhanced_select("Indonesia... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/destination_groups_spec.rb | Ruby | mit | 95 | develop | 4,212 | require "rails_helper"
RSpec.describe "Destination Groups" do
it "filter destination groups" do
carrier = create(:carrier)
create(:destination_group, carrier:, name: "Smart Cambodia", prefixes: [ "85510", "85515", "85516" ])
create(:destination_group, carrier:, name: "Metfone Cambodia", prefixes: [ "8559... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/tariff_plans_spec.rb | Ruby | mit | 95 | develop | 8,208 | require "rails_helper"
RSpec.describe "Tariff Plans" do
it "filter plans" do
carrier = create(:carrier)
plan = create(:tariff_plan, :outbound_calls, carrier:, name: "Discount")
excluded_plans = [
create(:tariff_plan, :outbound_calls, carrier:, name: "Special"),
create(:tariff_plan, :outbound_... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/events_spec.rb | Ruby | mit | 95 | develop | 899 | require "rails_helper"
RSpec.describe "Events" do
it "List events" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
phone_call = create(:phone_call, carrier:)
event1 = create(:event, :phone_call_completed, phone_call:, carrier:)
event2 = create(:event, :phone_call_completed,... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/error_logs_spec.rb | Ruby | mit | 95 | develop | 791 | require "rails_helper"
RSpec.describe "Error Logs" do
it "List error logs" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
create(:error_log, :inbound_message, carrier:, error_message: "Phone number 1234 does not exist")
create(:error_log, :inbound_call, carrier:, error_messag... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/home_spec.rb | Ruby | mit | 95 | develop | 660 | require "rails_helper"
RSpec.describe "Dashboard Home" do
it "Redirects a carrier user to the carrier home page" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
carrier_sign_in(user)
visit dashboard_root_path
expect(page).to have_current_path(dashboard_carrier_settings_pa... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/tariff_packages_spec.rb | Ruby | mit | 95 | develop | 7,763 | require "rails_helper"
RSpec.describe "Tariff Packages" do
it "filter packages" do
carrier = create(:carrier)
package = create(:tariff_package, carrier:, name: "Standard 1")
plan = create(:tariff_plan, carrier:)
create(:tariff_package_plan, package:, plan:)
excluded_packages = [
create(:tar... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/verification_services_spec.rb | Ruby | mit | 95 | develop | 4,043 | require "rails_helper"
RSpec.describe "Verification Services" do
it "List and filter verification services" do
verification_service = create(:verification_service, name: "Rocket Rides")
create(:verification_service, account: verification_service.account, name: "Foobar")
user = create(:user, :carrier, car... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/authentication_spec.rb | Ruby | mit | 95 | develop | 6,555 | require "rails_helper"
RSpec.describe "Authentication" do
it "Sign in with OTP" do
carrier = create_carrier
user = create(:user, :carrier, carrier:, password: "Super Secret")
visit(new_user_session_path)
fill_in("Email", with: user.email)
fill_in("Password", with: "Super Secret")
fill_in("OT... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/sip_trunks_spec.rb | Ruby | mit | 95 | develop | 5,350 | require "rails_helper"
RSpec.describe "SIP Trunks" do
it "List and filter SIP trunks" do
carrier = create(:carrier)
user = create(:user, :carrier, carrier:)
create(
:sip_trunk,
carrier:,
region: :hydrogen,
name: "Main SIP Trunk",
created_at: Time.utc(2021, 12, 1)
)
c... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/messaging_services_spec.rb | Ruby | mit | 95 | develop | 5,505 | require "rails_helper"
RSpec.describe "Messaging Services" do
it "List and filter messaging services" do
carrier = create(:carrier)
account = create(:account, carrier:)
create(:messaging_service, account:, carrier:, name: "My Messaging Service")
create(:messaging_service, account:, carrier:, name: "F... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/carrier_settings_spec.rb | Ruby | mit | 95 | develop | 2,891 | require "rails_helper"
RSpec.describe "Carrier Settings" do
it "Update carrier settings" do
carrier = create(:carrier, name: "My Carrier", billing_currency: "USD")
user = create(:user, :carrier, :owner, carrier:)
create(:tariff_package, carrier:, name: "Standard Package")
carrier_sign_in(user)
v... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/available_phone_numbers_spec.rb | Ruby | mit | 95 | develop | 2,582 | require "rails_helper"
RSpec.describe "Available Phone Numbers" do
it "List and filter available phone numbers" do
carrier = create(:carrier, country_code: "CA", billing_currency: "CAD")
account = create(:account, carrier:, billing_currency: "CAD")
common_attributes = {
carrier:,
type: :local... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/tariff_schedules_spec.rb | Ruby | mit | 95 | develop | 6,605 | require "rails_helper"
RSpec.describe "Tariff Schedules" do
it "filter schedules" do
carrier = create(:carrier)
plan = create(:tariff_plan, :outbound_messages, carrier:)
schedule = create(:tariff_schedule, category: plan.category, carrier:, name: "Standard")
create(:tariff_plan_tier, schedule:, plan:... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/documentation_spec.rb | Ruby | mit | 95 | develop | 502 | require "rails_helper"
RSpec.describe "Documentation" do
it "Shows carrier account API documentation" do
carrier = create(:carrier, :with_logo, :with_favicon, name: "AT&T", custom_api_host: "api.att.com")
set_app_host(carrier)
visit(docs_twilio_api_path)
expect(page).to have_css("img[alt='AT&T']")
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/system/dashboard/broadcasts_spec.rb | Ruby | mit | 95 | develop | 877 | require "rails_helper"
RSpec.describe "Broadcasts" do
it "List broadcasts for Pakistan" do
carrier = create(:carrier, country_code: "PK")
user = create(:user, :carrier, carrier:, id: "d28bb460-1324-4aa5-860a-8ef48fb5ca7f")
carrier_sign_in(user)
visit dashboard_root_path
click_on "Broadcasts"
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/routes_spec.rb | Ruby | mit | 95 | develop | 1,380 | require "rails_helper"
RSpec.describe "Routes" do
it "blocks requests to admin panel for custom domains" do
get(admin_root_path)
expect(response).to have_http_status(:not_found)
end
it "blocks requests to sign up for subdomains" do
get(new_user_registration_path)
expect(response).to have_http_... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/pagination_spec.rb | Ruby | mit | 95 | develop | 5,096 | require "rails_helper"
RSpec.resource "Pagination", document: :twilio_api do
explanation <<~HEREDOC
When fetching multiple pages of API results, use the provided `next_page_uri` parameter to retrieve the next page of results.
HEREDOC
parameter(
"PageSize",
"How many resources to return in each list ... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/available_phone_numbers_spec.rb | Ruby | mit | 95 | develop | 15,466 | require "rails_helper"
RSpec.resource "Available Phone Numbers", document: :twilio_api do
get "https://api.somleng.org/2010-04-01/Accounts/:AccountSid/AvailablePhoneNumbers/:CountryCode/:Type" do
parameter(
"AccountSid",
"*Path Parameter*: The SID of the Account requesting the AvailablePhoneNumber re... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/phone_calls_spec.rb | Ruby | mit | 95 | develop | 12,584 | require "rails_helper"
RSpec.resource "Phone Calls", document: :twilio_api do
header("Content-Type", "application/x-www-form-urlencoded")
post "https://api.somleng.org/2010-04-01/Accounts/:AccountSid/Calls" do
parameter(
"AccountSid",
"*Path Parameter*: The SID of the Account that will create the ... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/recordings_spec.rb | Ruby | mit | 95 | develop | 6,001 | require "rails_helper"
RSpec.resource "Recordings", document: :twilio_api do
get "https://api.somleng.org/2010-04-01/Accounts/:AccountSid/Recordings/:Sid" do
parameter(
"AccountSid",
"*Path Parameter*: The SID of the Account that created the Recording resource to fetch."
)
parameter(
"S... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/incoming_phone_numbers_spec.rb | Ruby | mit | 95 | develop | 12,361 | require "rails_helper"
RSpec.resource "Incoming Phone Numbers", document: :twilio_api do
# https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource
explanation <<~HEREDOC
An `IncomingPhoneNumber` resource represents a phone number provisioned to your account.
The IncomingPhoneNumbers lis... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/accounts_spec.rb | Ruby | mit | 95 | develop | 931 | require "rails_helper"
RSpec.resource "Accounts", document: :twilio_api do
get "https://api.somleng.org/2010-04-01/Accounts/:Sid" do
parameter(
"Sid",
"*Path Parameter*: The Account Sid that uniquely identifies the account to fetch."
)
# https://www.twilio.com/docs/iam/api/account#fetch-an-a... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/messages_spec.rb | Ruby | mit | 95 | develop | 16,308 | require "rails_helper"
RSpec.resource "Messages", document: :twilio_api do
header("Content-Type", "application/x-www-form-urlencoded")
post "https://api.somleng.org/2010-04-01/Accounts/:AccountSid/Messages" do
parameter(
"AccountSid",
"*Path Parameter*: The SID of the Account creating the Message ... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/authentication_spec.rb | Ruby | mit | 95 | develop | 1,871 | require "rails_helper"
RSpec.describe "Twilio API Authentication" do
it "requires http basic authentication" do
account = create(:account)
post(
api_twilio_account_phone_calls_path(account)
)
expect(response.code).to eq("401")
expect(response.headers["WWW-Authenticate"]).to eq(
%(Be... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/verify/verifications_spec.rb | Ruby | mit | 95 | develop | 12,409 | require "rails_helper"
RSpec.resource "Verifications", document: :twilio_api do
post "https://verify.somleng.org/v2/Services/:ServiceSid/Verifications" do
parameter(
"ServiceSid",
"*Path Parameter*: The SID of the verification Service to create the resource under.",
)
parameter(
"To",
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/twilio_api/verify/services_spec.rb | Ruby | mit | 95 | develop | 4,507 | require "rails_helper"
RSpec.resource "Verification Services", document: :twilio_api do
post "https://verify.somleng.org/v2/Services" do
parameter(
"FriendlyName",
"*Request Body Parameter*: A descriptive string that you create to describe the verification service. It can be up to 32 characters long.... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/tts_events_spec.rb | Ruby | mit | 95 | develop | 844 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /tts_events" do
it "creates a TTS event" do
phone_call = create(
:phone_call,
:answered
)
post(
services_tts_events_path,
params: {
phone_call: phone_call.id,
tts_v... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/phone_call_events_spec.rb | Ruby | mit | 95 | develop | 1,036 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /phone_call_events" do
it "creates a phone call event" do
phone_call = create(
:phone_call,
:answered,
status_callback_url: "https://somleng-status-callback.free.beeceptor.com"
)
perform_enque... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/inbound_phone_calls_spec.rb | Ruby | mit | 95 | develop | 3,744 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /inbound_phone_calls" do
it "creates a phone call" do
carrier = create(:carrier)
account = create(:account, carrier:, billing_mode: :prepaid, billing_enabled: false)
create(
:incoming_phone_number,
acc... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/outbound_phone_calls_spec.rb | Ruby | mit | 95 | develop | 2,995 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /outbound_phone_calls" do
it "creates a new outbound call" do
carrier = create(:carrier)
sip_trunk = create(
:sip_trunk,
carrier:,
sip_profile: "nat_gateway",
outbound_host: "27.109.112.141",... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/media_stream_events_spec.rb | Ruby | mit | 95 | develop | 1,070 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /media_stream_events" do
it "creates an media stream event" do
media_stream = create(:media_stream)
post(
services_media_stream_events_path,
params: {
media_stream_id: media_stream.id,
e... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/media_streams_spec.rb | Ruby | mit | 95 | develop | 925 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /media_streams" do
it "creates a media stream" do
phone_call = create(:phone_call)
post(
services_media_streams_path,
params: {
phone_call_id: phone_call.id,
tracks: "inbound",
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/call_heartbeats_spec.rb | Ruby | mit | 95 | develop | 610 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /call_heartbeats" do
it "creates call heartbeats" do
phone_calls = create_list(:phone_call, 2, :outbound, :initiated)
post(
services_call_heartbeats_path,
params: {
call_ids: phone_calls.pluck(:ex... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/call_data_records_spec.rb | Ruby | mit | 95 | develop | 2,169 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /call_data_records" do
it "creates a call data record" do
freeswitch_cdr = file_fixture("freeswitch_cdr.json").read
carrier = create(:carrier)
oauth_application = create(:oauth_application, owner: carrier)
webh... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/call_service_capacities_spec.rb | Ruby | mit | 95 | develop | 470 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /call_service_capacities" do
it "updates the call service capacity" do
post(
services_call_service_capacities_path,
params: { region: :hydrogen, capacity: 2 },
headers: build_authorization_headers("service... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/services/recordings_spec.rb | Ruby | mit | 95 | develop | 1,294 | require "rails_helper"
RSpec.describe "Services", :services do
describe "POST /recordings" do
it "creates a recording" do
phone_call = create(:phone_call)
post(
services_recordings_path,
params: { phone_call_id: phone_call.id },
headers: build_authorization_headers("services"... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/carrier_api/v1/phone_numbers_spec.rb | Ruby | mit | 95 | develop | 14,363 | require "rails_helper"
resource "Phone Numbers", document: :carrier_api do
header("Content-Type", "application/vnd.api+json")
post "https://api.somleng.org/carrier/v1/phone_numbers" do
with_options scope: %i[data attributes] do
parameter(
:number,
"Phone number in E.164 format or shortco... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/carrier_api/v1/messages_spec.rb | Ruby | mit | 95 | develop | 3,448 | require "rails_helper"
resource "Messages", document: :carrier_api do
header("Content-Type", "application/vnd.api+json")
get "https://api.somleng.org/carrier/v1/messages" do
with_options scope: :filter do
parameter(
:account, "Return messages from the provided account-sid"
)
paramete... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/carrier_api/v1/accounts_spec.rb | Ruby | mit | 95 | develop | 6,552 | require "rails_helper"
resource "Accounts", document: :carrier_api do
header("Content-Type", "application/vnd.api+json")
post "https://api.somleng.org/carrier/v1/accounts" do
with_options scope: %i[data attributes] do
parameter(
:name,
"A friendly name which identifies the account",
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/carrier_api/v1/phone_calls_spec.rb | Ruby | mit | 95 | develop | 3,881 | require "rails_helper"
resource "Phone Calls", document: :carrier_api do
header("Content-Type", "application/vnd.api+json")
get "https://api.somleng.org/carrier/v1/phone_calls" do
with_options scope: :filter do
parameter(
:account, "Return phone calls from the provided `account-sid`"
)
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/carrier_api/v1/events_spec.rb | Ruby | mit | 95 | develop | 1,692 | require "rails_helper"
resource "Events", document: :carrier_api do
header("Content-Type", "application/vnd.api+json")
get "https://api.somleng.org/carrier/v1/events" do
example "List all events" do
explanation <<~HEREDOC
### Types of events
This is a list of all the types of events we ... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/requests/carrier_api/v1/tts_events_spec.rb | Ruby | mit | 95 | develop | 2,036 | require "rails_helper"
resource "TTS Events", document: :carrier_api do
header("Content-Type", "application/vnd.api+json")
get "https://api.somleng.org/carrier/v1/tts_events" do
with_options scope: :filter do
parameter(
:account, "Return TTS Events from the provided account SID"
)
pa... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/route_constraints/app_subdomain_constraint_spec.rb | Ruby | mit | 95 | develop | 724 | require "rails_helper"
RSpec.describe AppSubdomainConstraint do
it "handles handles app subdomains" do
create(:carrier, subdomain: "foobar")
constraint = AppSubdomainConstraint.new
request = stub_request(
"HTTP_HOST" => "foobar.app.somleng.org"
)
result = constraint.matches?(request)
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/captcha_helpers.rb | Ruby | mit | 95 | develop | 285 | RSpec.configure do |config|
config.around(captcha: true) do |example|
skip_verify_env = Recaptcha.configuration.skip_verify_env.dup
Recaptcha.configuration.skip_verify_env.delete("test")
example.run
Recaptcha.configuration.skip_verify_env = skip_verify_env
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/app_settings_helpers.rb | Ruby | mit | 95 | develop | 557 | module AppSettingsHelpers
def stub_app_settings(app_settings)
allow(Rails.configuration.app_settings).to receive(:[]).and_call_original
allow(Rails.configuration.app_settings).to receive(:fetch).with(any_args).and_call_original
app_settings.each do |key, value|
allow(Rails.configuration.app_setting... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/system_spec_helpers.rb | Ruby | mit | 95 | develop | 1,107 | module SystemSpecHelpers
def carrier_sign_in(user)
set_app_host(user.carrier)
sign_in(user)
end
def set_app_host(carrier)
Capybara.app_host = "http://#{carrier.subdomain_host}"
end
def accept_confirm(*)
Capybara.current_driver == :rack_test ? yield : super
end
def enhanced_select(*value... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/request_schema_matchers.rb | Ruby | mit | 95 | develop | 1,692 | module RequestSchemaMatchers
extend RSpec::Matchers::DSL
module Helpers
def valid?(actual, *path)
actual.errors.none? { |e| e.path == path }
end
def invalid?(actual, *path)
options = path.extract_options!
errors = actual.errors.to_h.dig(*path)
return false if errors.blank?
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/rspec_api_documentation.rb | Ruby | mit | 95 | develop | 5,207 | require "rspec_api_documentation/dsl"
RspecApiDocumentation.configure do |config|
config.api_name = "Somleng API Documentation"
config.format = [ :somleng_slate ]
config.curl_host = ""
config.curl_headers_to_filter = %w[Host Cookie Version]
config.request_headers_to_include = []
config.response_headers_t... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/rating_engine_helpers.rb | Ruby | mit | 95 | develop | 572 | module RatingEngineHelpers
def stub_rating_engine_request(**options)
options.reverse_merge!(
response: { result: options.fetch(:result, "OK"), error: options.fetch(:error, nil) }
)
stub_request(:post, "#{AppSettings.fetch(:rating_engine_host)}/jsonrpc").to_return ->(request) {
{
statu... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_documentation_helpers.rb | Ruby | mit | 95 | develop | 202 | module APIDocumentationHelpers
def client
@client ||= APIDocumentationClient.new(self)
end
end
RSpec.configure do |config|
config.prepend(APIDocumentationHelpers, api_doc_dsl: :resource)
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/request_helpers.rb | Ruby | mit | 95 | develop | 1,236 | module RequestHelpers
def json_response(body = response_body)
JSON.parse(body)
end
def jsonapi_response_attributes
json_response.dig("data", "attributes")
end
def build_api_authorization_headers(account)
build_authorization_headers(account.id, account.auth_token)
end
def build_authorization... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/capybara.rb | Ruby | mit | 95 | develop | 563 | 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, type: :system, js: true) do
driven_by :selenium_ch... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/email_spec.rb | Ruby | mit | 95 | develop | 303 | require "email_spec"
require "email_spec/rspec"
module EmailSpecHelpers
def visit_full_link_in_email(title)
link = Capybara.string(current_email.default_part_body).find_link(title)
visit(link[:href])
end
end
RSpec.configure do |config|
config.include EmailSpecHelpers, type: :system
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/redis_queue_helpers.rb | Ruby | mit | 95 | develop | 824 | module RedisQueueHelpers
def build_test_queue(queue)
decorator = Class.new(SimpleDelegator) do
def tmp_enqueue(item, score: Time.current, processing_started_at: Time.current)
object.backend.with do |connection|
connection.zadd(object.tmp_key, score.to_f, item, nx: true)
connectio... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/factory_helpers.rb | Ruby | mit | 95 | develop | 305 | module FactoryHelpers
def create_restricted_carrier(*args)
stub_const("CarrierStanding::MAX_TRIAL_INTERACTIONS_PER_MONTH", 1)
carrier = create(:carrier, :restricted, *args)
create(:interaction, carrier:)
carrier
end
end
RSpec.configure do |config|
config.include FactoryHelpers
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_documentation_client.rb | Ruby | mit | 95 | develop | 1,930 | class APIDocumentationClient < RspecApiDocumentation::RackTestClient
class Curl < RspecApiDocumentation::Curl
LINE_JOINER = " \\\n\t".freeze
attr_accessor :content_type, :docs_group
def post
return super unless content_type == "application/x-www-form-urlencoded"
post_data = Rack::Utils.pars... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/mock_redis.rb | Ruby | mit | 95 | develop | 2,390 | AppSettings.redis_client = -> { MockRedis.new }
RSpec.configure do |config|
config.before do
stubbed_implementations = lambda do |original_method, *args, &block|
case args.first
when UniqueFIFOQueue::ENQUEUE_SCRIPT
key, tmp_key = args.last.fetch(:keys)
score, item = args.last.fetch(:a... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/web_mock.rb | Ruby | mit | 95 | develop | 273 | require "webmock/rspec"
WebMock.disable_net_connect!(allow_localhost: true)
RSpec.configure do |config|
config.around(allow_net_connect: true) do |example|
WebMock.allow_net_connect!
example.run
WebMock.disable_net_connect!(allow_localhost: true)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/somleng_slate_example.rb | Ruby | mit | 95 | develop | 391 | class SomlengSlateExample < 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 | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schema_matchers.rb | Ruby | mit | 95 | develop | 4,608 | 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 | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/jsonapi_error_schema.rb | Ruby | mit | 95 | develop | 284 | module APIResponseSchema
JSONAPIErrorSchema = Dry::Schema.JSON do
required(:errors).value(:array).each do
schema do
optional(:source).hash do
required(:pointer).filled(:str?)
end
required(:title).filled(:str?)
end
end
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/services/media_stream_schema.rb | Ruby | mit | 95 | develop | 261 | module APIResponseSchema
module Services
MediaStreamSchema = Dry::Schema.Params do
required(:sid).filled(:str?)
required(:url).filled(:str?)
required(:created_at).filled(:str?)
required(:updated_at).filled(:str?)
end
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/services/outbound_phone_calls_schema.rb | Ruby | mit | 95 | develop | 1,335 | module APIResponseSchema
module Services
OutboundPhoneCallsSchema = Dry::Schema.JSON do
required(:phone_calls).value(:array).each do
schema do
required(:sid).filled(:str?)
required(:account_sid).filled(:str?)
required(:carrier_sid).filled(:str?)
required(:pare... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/services/inbound_phone_call_schema.rb | Ruby | mit | 95 | develop | 1,205 | module APIResponseSchema
module Services
InboundPhoneCallSchema = Dry::Schema.Params do
required(:voice_url).maybe(:str?)
required(:voice_method).maybe(:str?)
optional(:status_callback_url).maybe(:str?)
optional(:status_callback_method).maybe(:str?)
required(:twiml).maybe(:str?)
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/services/recording_schema.rb | Ruby | mit | 95 | develop | 317 | module APIResponseSchema
module Services
RecordingSchema = Dry::Schema.Params do
required(:sid).filled(:str?)
required(:duration).maybe(:str?)
required(:url).filled(:str?, format?: /\Ahttp/)
required(:created_at).filled(:str?)
required(:updated_at).filled(:str?)
end
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/incoming_phone_number_schema.rb | Ruby | mit | 95 | develop | 2,521 | # https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource#incomingphonenumber-properties
module APIResponseSchema
module TwilioAPI
IncomingPhoneNumberSchema = Dry::Schema.Params do
required(:sid).filled(:str?)
required(:account_sid).filled(:str?)
required(:api_version).filled... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/country_schema.rb | Ruby | mit | 95 | develop | 817 | # https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource#fetch-a-specific-country
module APIResponseSchema
module TwilioAPI
CountrySchema = Dry::Schema.Params do
required(:country_code).filled(:str?)
required(:country).filled(:str?)
required(:uri).filled(:str?)
requir... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/available_phone_number_schema.rb | Ruby | mit | 95 | develop | 997 | # https://www.twilio.com/docs/phone-numbers/api/availablephonenumberlocal-resource#availablephonenumberlocal-properties
module APIResponseSchema
module TwilioAPI
AvailablePhoneNumberSchema = Dry::Schema.Params do
required(:friendly_name).filled(:str?)
required(:phone_number).filled(:str?)
requi... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/account_schema.rb | Ruby | mit | 95 | develop | 811 | # https://www.twilio.com/docs/iam/api/account#account-properties
module APIResponseSchema
module TwilioAPI
AccountSchema = Dry::Schema.Params do
required(:status).filled(:string, included_in?: [ "active", "suspended", "closed" ])
required(:auth_token).filled(:str?)
required(:friendly_name).fill... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/api_errors_schema.rb | Ruby | mit | 95 | develop | 260 | module APIResponseSchema
module TwilioAPI
APIErrorsSchema = Dry::Schema.Params do
required(:message).filled(:str?)
required(:code).filled(:str?)
required(:status).filled(:int?)
required(:more_info).filled(:str?)
end
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/message_schema.rb | Ruby | mit | 95 | develop | 1,081 | module APIResponseSchema
module TwilioAPI
MessageSchema = Dry::Schema.Params do
required(:account_sid).maybe(:str?)
required(:api_version).filled(:str?, eql?: "2010-04-01")
required(:body).maybe(:str?)
required(:date_created).maybe(:str?)
required(:date_sent).maybe(:str?)
requi... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/recording_schema.rb | Ruby | mit | 95 | develop | 939 | module APIResponseSchema
module TwilioAPI
RecordingSchema = Dry::Schema.Params do
required(:account_sid).filled(:str?)
required(:api_version).filled(:str?, eql?: "2010-04-01")
required(:call_sid).filled(:str?)
required(:conference_sid).maybe(:str?)
required(:channels).filled(:int?)
... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/call_schema.rb | Ruby | mit | 95 | develop | 1,181 | module APIResponseSchema
module TwilioAPI
CallSchema = Dry::Schema.Params do
required(:annotation).maybe(:str?)
required(:parent_call_sid).maybe(:str?)
required(:answered_by).maybe(:str?)
required(:caller_name).maybe(:str?)
required(:direction).filled(:str?, included_in?: %w[inbound ... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/verify/verification_schema.rb | Ruby | mit | 95 | develop | 772 | module APIResponseSchema
module TwilioAPI
module Verify
VerificationSchema = Dry::Schema.Params do
required(:sid).filled(:str?)
required(:service_sid).filled(:str?)
required(:account_sid).filled(:str?)
required(:to).filled(:str?, format?: /\A\+/)
required(:channel).fi... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/verify/service_schema.rb | Ruby | mit | 95 | develop | 437 | module APIResponseSchema
module TwilioAPI
module Verify
ServiceSchema = Dry::Schema.Params do
required(:sid).filled(:str?)
required(:account_sid).filled(:str?)
required(:friendly_name).filled(:str?)
required(:code_length).filled(:int?)
required(:date_created).filled(:... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/twilio_api/verify/verification_check_schema.rb | Ruby | mit | 95 | develop | 497 | module APIResponseSchema
module TwilioAPI
module Verify
VerificationCheckSchema = Dry::Schema.Params do
required(:sid).filled(:str?)
required(:service_sid).filled(:str?)
required(:account_sid).filled(:str?)
required(:to).filled(:str?, format?: /\A\+/)
required(:channe... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/carrier_api/phone_call_schema.rb | Ruby | mit | 95 | develop | 554 | module APIResponseSchema
module CarrierAPI
PhoneCallSchema = Dry::Schema.JSON do
required(:id).filled(:str?)
required(:type).filled(eql?: "phone_call")
required(:attributes).schema do
required(:to).filled(:str?)
required(:from).filled(:str?)
end
required(:relationsh... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/carrier_api/tts_event_schema.rb | Ruby | mit | 95 | develop | 847 | module APIResponseSchema
module CarrierAPI
TTSEventSchema = Dry::Schema.JSON do
required(:id).filled(:str?)
required(:type).filled(eql?: "tts_event")
required(:attributes).schema do
required(:voice).filled(:str?)
required(:characters).filled(:int?)
required(:created_at).... |
github | somleng/somleng | https://github.com/somleng/somleng | spec/support/api_response_schemas/carrier_api/account_schema.rb | Ruby | mit | 95 | develop | 618 | module APIResponseSchema
module CarrierAPI
AccountSchema = Dry::Schema.JSON do
required(:id).filled(:str?)
required(:type).filled(eql?: "account")
required(:attributes).schema do
required(:name).filled(:str?)
required(:status).filled(:str?)
required(:type).filled(:str?)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.