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/support/api_response_schemas/carrier_api/message_schema.rb
Ruby
mit
95
develop
587
module APIResponseSchema module CarrierAPI MessageSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "message") required(:attributes).schema do required(:to).filled(:str?) required(:from).filled(:str?) required(:body).filled(:str?) ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/support/api_response_schemas/carrier_api/phone_number_schema.rb
Ruby
mit
95
develop
944
module APIResponseSchema module CarrierAPI PhoneNumberSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "phone_number") required(:attributes).schema do required(:number).filled(:str?) required(:visibility).filled(:str?, included_in?: [ "public...
github
somleng/somleng
https://github.com/somleng/somleng
spec/support/api_response_schemas/carrier_api/aggregate_data_schema.rb
Ruby
mit
95
develop
289
module APIResponseSchema module CarrierAPI AggregateDataSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "aggregate_data") required(:attributes).schema do required(:statistic).filled(:hash?) end end end end
github
somleng/somleng
https://github.com/somleng/somleng
spec/support/api_response_schemas/carrier_api/event_schema.rb
Ruby
mit
95
develop
443
module APIResponseSchema module CarrierAPI EventSchema = Dry::Schema.JSON do required(:id).filled(:str?) required(:type).filled(eql?: "event") required(:attributes).schema do required(:type).filled(:str?) required(:details).schema do required(:data).filled(:hash) ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/filters/phone_call_filter_spec.rb
Ruby
mit
95
develop
1,934
require "rails_helper" RSpec.describe PhoneCallFilter do it "filters by account" do carrier = create(:carrier) account = create(:account, carrier:) phone_call = create(:phone_call, account:) _other_phone_call = create(:phone_call) filter = PhoneCallFilter.new( resources_scope: PhoneCall, ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/filters/account_filter_spec.rb
Ruby
mit
95
develop
2,183
require "rails_helper" RSpec.describe AccountFilter do it "Filters by metadata" do account = create( :account, metadata: { foo: "bar" } ) _other_account = create(:account) filter = AccountFilter.new( resources_scope: Account, input_params: { filter: { ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/filters/verification_filter_spec.rb
Ruby
mit
95
develop
1,158
require "rails_helper" RSpec.describe VerificationFilter do it "filters by status" do pending_verification = create(:verification, :pending) expired_verification = create(:verification, :expired) approved_verification = create(:verification, :approved) canceled_verification = create(:verification, :c...
github
somleng/somleng
https://github.com/somleng/somleng
spec/filters/phone_number_filter_spec.rb
Ruby
mit
95
develop
1,103
require "rails_helper" RSpec.describe PhoneNumberFilter do it "filters by assigned" do carrier = create(:carrier) account = create(:account, carrier:) assigned_phone_number = create(:phone_number, carrier:) unassigned_phone_number = create(:phone_number, carrier:) create(:phone_number_plan, accou...
github
somleng/somleng
https://github.com/somleng/somleng
spec/filters/tariff_schedule_filter_spec.rb
Ruby
mit
95
develop
1,005
require "rails_helper" RSpec.describe TariffScheduleFilter do it "filters by the tariff plan id" do carrier = create(:carrier) plan = create(:tariff_plan, carrier:) schedule = create(:tariff_schedule, carrier:) create(:tariff_plan_tier, plan:, schedule:) create(:tariff_schedule, carrier:) ex...
github
somleng/somleng
https://github.com/somleng/somleng
spec/filters/tariff_plan_filter_spec.rb
Ruby
mit
95
develop
522
require "rails_helper" RSpec.describe TariffPlanFilter do it "filters by the tariff schedule id" do carrier = create(:carrier) plan = create(:tariff_plan, carrier:) schedule = create(:tariff_schedule, carrier:) create(:tariff_plan_tier, plan:, schedule:) create(:tariff_plan, carrier:) expect...
github
somleng/somleng
https://github.com/somleng/somleng
spec/filters/message_filter_spec.rb
Ruby
mit
95
develop
1,001
require "rails_helper" RSpec.describe MessageFilter do it "filters by status" do sending_message = create(:message, :sending) _sent_messaage = create(:message, :sent) filter = MessageFilter.new( resources_scope: Message, input_params: { filter: { status: "sending" }...
github
somleng/somleng
https://github.com/somleng/somleng
spec/filters/phone_number_plan_filter_spec.rb
Ruby
mit
95
develop
758
require "rails_helper" RSpec.describe PhoneNumberPlanFilter do it "filters by status" do filtered_plan = create(:phone_number_plan, :active) create(:phone_number_plan, :canceled) expect( PhoneNumberPlanFilter.new( resources_scope: PhoneNumberPlan, input_params: { filter: { status: ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/update_message_request_schema_spec.rb
Ruby
mit
95
develop
2,495
require "rails_helper" module TwilioAPI RSpec.describe UpdateMessageRequestSchema, type: :request_schema do it "validates Body" do queued_message = create(:message, :queued) expect( validate_request_schema( input_params: { Body: "" } ) ).to have_...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/phone_call_request_schema_spec.rb
Ruby
mit
95
develop
8,973
require "rails_helper" module TwilioAPI RSpec.describe PhoneCallRequestSchema, type: :request_schema do it "validates To" do carrier = create(:carrier) account = create(:account, carrier:) account_with_no_sip_trunks = create(:account) account_with_blocked_list = create(:account, allowed_c...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/update_phone_call_request_schema_spec.rb
Ruby
mit
95
develop
4,183
require "rails_helper" module TwilioAPI RSpec.describe UpdatePhoneCallRequestSchema, type: :request_schema do it "validates the call status" do expect( validate_request_schema( input_params: {}, options: { phone_call: build_stubbed(:phone_call, :queued) } ) ).to ha...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/incoming_phone_number_request_schema_spec.rb
Ruby
mit
95
develop
4,871
require "rails_helper" module TwilioAPI RSpec.describe IncomingPhoneNumberRequestSchema, type: :request_schema do it "validates PhoneNumber" do account = create(:account) public_number = create(:phone_number, visibility: :public, carrier: account.carrier) private_number = create(:phone_number, ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/message_request_schema_spec.rb
Ruby
mit
95
develop
9,934
require "rails_helper" module TwilioAPI RSpec.describe MessageRequestSchema, type: :request_schema do it "validates To" do carrier = create(:carrier) account = create(:account, carrier:) billing_enabled_account = create(:account, :billing_enabled, carrier:) unreachable_carrier_account = c...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/available_phone_number_filter_request_schema_spec.rb
Ruby
mit
95
develop
1,500
require "rails_helper" module TwilioAPI RSpec.describe AvailablePhoneNumberFilterRequestSchema, type: :request_schema do it "validates InRateCenter and InLata" do expect( validate_request_schema( input_params: { InLata: "888", InRateCenter: "NEWTORONTO" }...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/verify/service_request_schema_spec.rb
Ruby
mit
95
develop
2,093
require "rails_helper" module TwilioAPI module Verify RSpec.describe ServiceRequestSchema, type: :request_schema do it "validates FriendlyName" do expect( validate_request_schema( input_params: { FriendlyName: "a" * 30 } ) ).to have_...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/verify/update_verification_request_schema_spec.rb
Ruby
mit
95
develop
2,001
require "rails_helper" module TwilioAPI module Verify RSpec.describe UpdateVerificationRequestSchema, type: :request_schema do it "validates Status" do pending_verification = create(:verification, status: :pending) approved_verification = create(:verification, status: :approved) ex...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/verify/verification_request_schema_spec.rb
Ruby
mit
95
develop
8,219
require "rails_helper" module TwilioAPI module Verify RSpec.describe VerificationRequestSchema, type: :request_schema do it "validates To" do expect( validate_request_schema( input_params: { To: "+855716100235" } ) ).to have_valid_fi...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/twilio_api/verify/verification_check_request_schema_spec.rb
Ruby
mit
95
develop
2,595
require "rails_helper" module TwilioAPI module Verify RSpec.describe VerificationCheckRequestSchema, type: :request_schema do it "validates either To or VerificationSid is specified" do verification = create(:verification, status: :pending) expect( validate_request_schema( ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/carrier_api/update_account_request_schema_spec.rb
Ruby
mit
95
develop
1,746
require "rails_helper" module CarrierAPI RSpec.describe UpdateAccountRequestSchema, type: :request_schema do it "validates customer managed attributes" do carrier = create(:carrier) customer_managed_account = create(:account, :customer_managed, carrier:) expect( validate_request_schema...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/carrier_api/update_phone_call_request_schema_spec.rb
Ruby
mit
95
develop
2,087
require "rails_helper" module CarrierAPI RSpec.describe UpdatePhoneCallRequestSchema, type: :request_schema do it "validates price and price unit" do carrier = create(:carrier) phone_call = create(:phone_call, carrier:) expect( validate_request_schema( input_params: { ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/carrier_api/phone_call_filter_request_schema_spec.rb
Ruby
mit
95
develop
2,590
require "rails_helper" module CarrierAPI RSpec.describe PhoneCallFilterRequestSchema, type: :request_schema do it "validates the from_date and to_date" do expect( validate_request_schema( input_params: { filter: { from_date: Time.utc(2021, 11, 1).iso8601, ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/carrier_api/tts_event_filter_request_schema_spec.rb
Ruby
mit
95
develop
695
require "rails_helper" module CarrierAPI RSpec.describe TTSEventFilterRequestSchema, type: :request_schema do it "normalizes the output" do schema = validate_request_schema( input_params: { filter: { from_date: Time.utc(2021, 11, 1).iso8601, account: "account-id", ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/carrier_api/phone_number_request_schema_spec.rb
Ruby
mit
95
develop
11,957
require "rails_helper" module CarrierAPI RSpec.describe PhoneNumberRequestSchema, type: :request_schema do it "validates number" do carrier = create(:carrier) phone_number = create(:phone_number, number: "1234", carrier:) expect( validate_request_schema( input_params: { ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/carrier_api/phone_number_stats_request_schema_spec.rb
Ruby
mit
95
develop
3,539
require "rails_helper" module CarrierAPI RSpec.describe PhoneNumberStatsRequestSchema, type: :request_schema do it "validates the filter type" do expect( validate_request_schema( input_params: {} ) ).not_to have_valid_field(:filter) expect( validate_request_sc...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/services/media_stream_request_schema_spec.rb
Ruby
mit
95
develop
1,700
require "rails_helper" module Services RSpec.describe MediaStreamRequestSchema, type: :request_schema do it "validates phone_call_id" do phone_call = create(:phone_call) expect( validate_request_schema(input_params: { phone_call_id: phone_call.id }) ).to have_valid_field(:phone_call_id...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/services/inbound_phone_call_request_schema_spec.rb
Ruby
mit
95
develop
9,693
require "rails_helper" module Services RSpec.describe InboundPhoneCallRequestSchema, type: :request_schema do it "validates inbound source_ip" do _sip_trunk = create(:sip_trunk, inbound_source_ips: [ "175.100.7.240" ]) expect( validate_request_schema( input_params: { so...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/services/inbound_message_request_schema_spec.rb
Ruby
mit
95
develop
2,782
require "rails_helper" module Services RSpec.describe InboundMessageRequestSchema, type: :request_schema do it "validates carrier is in good standing" do carrier = create_restricted_carrier sms_gateway = create(:sms_gateway, carrier:) expect( validate_request_schema( options:...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/services/media_stream_event_request_schema_spec.rb
Ruby
mit
95
develop
1,028
require "rails_helper" module Services RSpec.describe MediaStreamEventRequestSchema, type: :request_schema do it "validates media_stream_id" do media_stream = create(:media_stream) expect( validate_request_schema(input_params: { media_stream_id: media_stream.id }) ).to have_valid_field...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/services/outbound_phone_calls_request_schema_spec.rb
Ruby
mit
95
develop
4,765
require "rails_helper" module Services RSpec.describe OutboundPhoneCallsRequestSchema, type: :request_schema do it "validates destinations" do carrier = create(:carrier) account = create(:account, carrier:) sip_trunk = create(:sip_trunk, carrier:, outbound_route_prefixes: [ "855" ]) paren...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/services/recording_request_schema_spec.rb
Ruby
mit
95
develop
2,225
require "rails_helper" module Services RSpec.describe RecordingRequestSchema, type: :request_schema do it "validates phone_call_id" do expect( validate_request_schema(input_params: { phone_call_id: "phone-call-id" }) ).to have_valid_field(:phone_call_id) expect( validate_reques...
github
somleng/somleng
https://github.com/somleng/somleng
spec/request_schemas/services/update_recording_request_schema_spec.rb
Ruby
mit
95
develop
716
require "rails_helper" module Services RSpec.describe UpdateRecordingRequestSchema, type: :request_schema do it "validates raw_recording_url" do expect( validate_request_schema(input_params: { raw_recording_url: "https://raw-recordings.s3.amazonaws.com/recording.wav" }) ).to have_valid_field(...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/ip_address_array_type_spec.rb
Ruby
mit
95
develop
619
require "rails_helper" RSpec.describe IPAddressArrayType do it "handles IP address arrays" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :ips, IPAddressArrayType.new end expect(klass.new(ips: nil).ips).to eq([]) expect(klass.new(ips: ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/hostname_type_spec.rb
Ruby
mit
95
develop
684
require "rails_helper" RSpec.describe HostnameType do it "handles hostnames" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :hostname, HostnameType.new end expect(klass.new(hostname: nil).hostname).to eq(nil) expect(klass.new(hostname:...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/form_collection_type_spec.rb
Ruby
mit
95
develop
2,585
require "rails_helper" RSpec.describe FormCollectionType do it "handles form collection types" do person_class = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :first_name attribute :last_name end person_form_class = Class.new(ApplicationForm) ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/tariff_schedule_category_type_spec.rb
Ruby
mit
95
develop
1,150
require "rails_helper" RSpec.describe TariffScheduleCategoryType do it "handles tariff schedule categories" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :category, TariffScheduleCategoryType.new end expect(klass.new(category: "inbound_ca...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/route_prefixes_type_spec.rb
Ruby
mit
95
develop
594
require "rails_helper" RSpec.describe RoutePrefixesType do it "handles route prefixes" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :route_prefixes, RoutePrefixesType.new end expect(klass.new(route_prefixes: []).route_prefixes).to eq([])...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/tts_voice_type_spec.rb
Ruby
mit
95
develop
485
require "rails_helper" RSpec.describe TTSVoiceType do it "handles TTS Voices" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :tts_voice, TTSVoiceType.new end expect(klass.new(tts_voice: "Basic.Kal").tts_voice).to have_attributes( ide...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/comma_separated_list_type_spec.rb
Ruby
mit
95
develop
646
require "rails_helper" RSpec.describe CommaSeparatedListType do it "handles comma separated lists" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :list, CommaSeparatedListType.new end expect(klass.new(list: []).list).to eq([]) expect(k...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/phone_number_type_spec.rb
Ruby
mit
95
develop
1,536
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: PhoneNumberType::PhoneNumber.new).number).to ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/currency_type_spec.rb
Ruby
mit
95
develop
553
require "rails_helper" RSpec.describe CurrencyType do it "handles currency types" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :currency, CurrencyType.new end expect(klass.new(currency: Money::Currency.new("USD")).currency).to eq(Money::...
github
somleng/somleng
https://github.com/somleng/somleng
spec/types/region_type_spec.rb
Ruby
mit
95
develop
502
require "rails_helper" RSpec.describe RegionType do it "handles regions" do klass = Class.new do include ActiveModel::Model include ActiveModel::Attributes attribute :region, RegionType.new end expect(klass.new(region: nil).region).to eq(nil) expect(klass.new(region: "foo").region...
github
somleng/somleng
https://github.com/somleng/somleng
spec/jobs/complete_phone_call_job_spec.rb
Ruby
mit
95
develop
3,565
require "rails_helper" RSpec.describe CompletePhoneCallJob do it "handles completed calls" do phone_call = create(:phone_call, :inbound, :initiated) create(:call_data_record, phone_call:, answer_time: Time.current, sip_term_status: "200") CompletePhoneCallJob.perform_now(phone_call) expect(phone_ca...
github
somleng/somleng
https://github.com/somleng/somleng
spec/jobs/daily_job_spec.rb
Ruby
mit
95
develop
387
require "rails_helper" RSpec.describe DailyJob do it "enqueues jobs to be run daily" do DailyJob.perform_now expect(ExecuteWorkflowJob).to have_been_enqueued.with(DeleteExpiredCarriers.to_s) expect(ExecuteWorkflowJob).to have_been_enqueued.with(ExpireQueuedPhoneCalls.to_s) expect(ExecuteWorkflowJob)...
github
somleng/somleng
https://github.com/somleng/somleng
spec/jobs/outbound_call_job_spec.rb
Ruby
mit
95
develop
3,467
require "rails_helper" RSpec.describe OutboundCallJob do it "initiates an outbound call" do account = create(:account) phone_call = create(:phone_call, account:, region: "helium") other_phone_call = create(:phone_call, account:) account_queue = build_queue(account) account_queue.enqueue(phone_cal...
github
somleng/somleng
https://github.com/somleng/somleng
spec/jobs/create_phone_call_event_job_spec.rb
Ruby
mit
95
develop
2,062
require "rails_helper" RSpec.describe CreatePhoneCallEventJob do it "handles ringing events" do phone_call = create(:phone_call, :initiated) CreatePhoneCallEventJob.perform_now( phone_call_external_id: phone_call.external_id, type: "ringing", params: { "foo" => "bar" } ) ...
github
somleng/somleng
https://github.com/somleng/somleng
spec/jobs/per_minute_job_spec.rb
Ruby
mit
95
develop
586
require "rails_helper" RSpec.describe PerMinuteJob do it "enqueues jobs to be run per minute" do PerMinuteJob.perform_now expect(ExecuteWorkflowJob).to have_been_enqueued.with(ExpireInProgressPhoneCalls.to_s) expect(ExecuteWorkflowJob).to have_been_enqueued.with(ProcessOutboundCallsQueue.to_s) expec...
github
somleng/somleng
https://github.com/somleng/somleng
spec/jobs/process_cdr_job_spec.rb
Ruby
mit
95
develop
3,711
require "rails_helper" RSpec.describe ProcessCDRJob do it "creates a call data record" do cdr = build_cdr( variables: { sip_term_status: "487", answer_epoch: "0", start_epoch: "1474362923", end_epoch: "1474362924", hangup_cause: "NORMAL_UNSPECIFIED", sip_invi...
github
somleng/somleng
https://github.com/somleng/somleng
spec/jobs/hourly_job_spec.rb
Ruby
mit
95
develop
399
require "rails_helper" RSpec.describe HourlyJob do it "enqueues jobs to be run hourly" do HourlyJob.perform_now expect(ExecuteWorkflowJob).to have_been_enqueued.with(ExpireInitiatingPhoneCalls.to_s) expect(ExecuteWorkflowJob).to have_been_enqueued.with(RevokeSIPTrunkPermissions.to_s) expect(ExecuteW...
github
somleng/somleng
https://github.com/somleng/somleng
spec/jobs/scheduled_job_spec.rb
Ruby
mit
95
develop
1,534
require "rails_helper" RSpec.describe ScheduledJob do it "re-enqueues the job to run in 15 minutes from now if wait until is longer that 15 minutes" do travel_to(Time.zone.local(2018, 1, 1)) do job_args = ["AFakeJob", 1, { foo: "bar", wait_until: 15.minutes.from_now.to_f }] ScheduledJob.perform_now(*...
github
somleng/somleng
https://github.com/somleng/somleng
spec/jobs/update_live_call_job_spec.rb
Ruby
mit
95
develop
2,436
require "rails_helper" RSpec.describe UpdateLiveCallJob do it "ends a call" do phone_call = create( :phone_call, :initiated, :user_terminated, external_id: "external-id", call_service_host: "10.10.1.13" ) call_service_client = instance_spy(CallService::Client, end_call: Open...
github
nogates/vigia
https://github.com/nogates/vigia
Gemfile
Ruby
mit
95
master
291
source 'https://rubygems.org' # RedSnow needs to download its git submodules before compiling gem 'redsnow', github: 'apiaryio/redsnow', submodules: true gem 'codeclimate-test-reporter', group: :test, require: nil # Pull raml from github gem 'raml_ruby', github: 'coub/raml_ruby' gemspec
github
nogates/vigia
https://github.com/nogates/vigia
vigia.gemspec
Ruby
mit
95
master
1,358
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'vigia/version' Gem::Specification.new do |spec| spec.name = 'vigia' spec.version = Vigia::VERSION spec.authors = ['David Tapiador', 'atlas2ninjas'] spec.email ...
github
nogates/vigia
https://github.com/nogates/vigia
Rakefile
Ruby
mit
95
master
609
require 'bundler/gem_tasks' require 'rspec/core/rake_task' require 'cucumber/rake/task' Cucumber::Rake::Task.new(:cucumber) do |t| t.cucumber_opts = '--tags ~@wip' end RSpec::Core::RakeTask.new(:spec) desc 'Clear tmp folders' task :clobber do FileUtils.rm_rf(File.join(__dir__, 'coverage')) end # Not sure why si...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia.rb
Ruby
mit
95
master
1,565
# encoding: utf-8 require 'redsnow' require 'raml' require 'rspec' require 'rest_client' require 'addressable/template' require_relative 'vigia/adapter' require_relative 'vigia/adapters/blueprint' require_relative 'vigia/adapters/raml' require_relative 'vigia/config' require_relative 'vigia/hooks' require_relative 'v...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/url.rb
Ruby
mit
95
master
930
require 'uri' require 'addressable/template' require 'addressable/uri' module Vigia class Url class << self def template_defines_url?(template, url) url_object = Addressable::URI.parse(url) template_object = Addressable::Template.new(template) url_parameters = template_object...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/config.rb
Ruby
mit
95
master
1,816
module Vigia class Config attr_accessor :source_file, :host, :custom_examples_paths, :custom_examples, :headers, :http_client_class attr_accessor :adapter, :hooks, :rspec_config_block, :stderr, :stdout, :internal_hosts, :load_default_examples def initialize @host = nil @sourc...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/parameters.rb
Ruby
mit
95
master
720
module Vigia class Parameters attr_reader :parameters def initialize(parameters) @parameters = parameters validate end def to_hash @parameters.each_with_object({}) do |parameter, hash| hash.merge!(parameter[:name] => parameter[:value]) end end def validate ...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/formatter.rb
Ruby
mit
95
master
3,516
RSpec::Support.require_rspec_core 'formatters/base_text_formatter' module Vigia class Formatter < RSpec::Core::Formatters::BaseTextFormatter include RSpec::Core::Formatters::ConsoleCodes RSpec::Core::Formatters.register self, :start, :example_group_started, :example_group_finished, ...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/adapter.rb
Ruby
mit
95
master
1,663
module Vigia class Adapter attr_accessor :source_file, :structure class << self def setup_adapter(&block) raise 'You have to call config_adapter with a block' unless block_given? @template = block end def template @template end def instance new...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/hooks.rb
Ruby
mit
95
master
1,267
module Vigia module Hooks def execute_hook(filter_name, rspec_context) hooks_for_object(filter_name).each do |hook| if self.is_a?(Vigia::Sail::Context) instance = self rspec_context.define_singleton_method(:vigia_context, -> { instance }) end rspec_context.insta...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/rspec.rb
Ruby
mit
95
master
1,512
module Vigia class Rspec class << self def include_shared_folders require_custom_examples require "#{ __dir__ }/spec/support/utils" end private def require_custom_examples if Vigia.config.custom_examples_paths [ *Vigia.config.custom_examples_paths ].sort....
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/adapters/raml.rb
Ruby
mit
95
master
4,904
module Vigia module Adapters class Raml < Vigia::Adapter attr_reader :raml setup_adapter do after_initialize do @raml = ::Raml::parse_file(source_file) end group :resource, primary: true, children: [ :method ], describes: -> ...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/adapters/blueprint.rb
Ruby
mit
95
master
7,283
module Vigia module Adapters class Blueprint < Vigia::Adapter attr_reader :apib, :apib_source setup_adapter do after_initialize do @apib_source = File.read(source_file) @apib_parsed = RedSnow::parse(@apib_source, { :exportSourcemap => true }) @apib = @ap...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/http_client/rest_client.rb
Ruby
mit
95
master
1,590
module Vigia module HttpClient class RestClient attr_accessor :code, :headers, :body def initialize(http_client_options) @http_client_options = http_client_options end def run cache_or_perform_request end def run! perform_request end priv...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/http_client/options.rb
Ruby
mit
95
master
858
module Vigia module HttpClient class Options < OpenStruct class << self def build(context, in_let_context) instance = new instance.context = context instance.options.each do |name, value| instance[name] = context.contextual_object(object: value, context: in_...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/sail/rspec_object.rb
Ruby
mit
95
master
1,435
module Vigia module Sail class RSpecObject class << self attr_reader :collection def register(name, options) @collection = {} if collection.nil? @collection.merge!(name => options) end def setup_and_run(name, rspec) items = collection.select{ |...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/sail/group_instance.rb
Ruby
mit
95
master
648
module Vigia module Sail class GroupInstance < Vigia::Sail::RSpecObject attr_accessor :parent_object, :described_object, :group, :description def run(rspec_context) with_hooks(rspec_context) do group.children.each do |group_name| Vigia::Sail::Group.setup_and_run(group_n...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/sail/example.rb
Ruby
mit
95
master
1,700
module Vigia module Sail class Example < Vigia::Sail::RSpecObject class << self def register(name, options) @collection = {} if collection.nil? @collection.merge!(name => options) end def run_in_context(context, rspec_context) @collection.each do |name,...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/sail/context.rb
Ruby
mit
95
master
2,548
module Vigia module Sail class Context < RSpecObject def run run_rspec_context unless disabled? end def set_http_client_options(in_let_context) Vigia::HttpClient::Options.build(self, in_let_context) end def set_expectations(in_let_context) Vigia::HttpClient...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/sail/group.rb
Ruby
mit
95
master
1,905
module Vigia module Sail class Group < Vigia::Sail::RSpecObject class << self def setup_and_run_primary(rspec) name, options = collection.select{ |k,v| v[:primary] == true }.first instance = new(name, options, rspec) instance.run end end def run ...
github
nogates/vigia
https://github.com/nogates/vigia
lib/vigia/sail/examples/default.rb
Ruby
mit
95
master
778
module Vigia module Sail module Examples module Default module_function def load! Vigia::Sail::Example.register( :code_match, description: 'has the expected HTTP code', expectation: -> { if expectations.code.is_a?(Range) ...
github
nogates/vigia
https://github.com/nogates/vigia
features/step_definitions/config.rb
Ruby
mit
95
master
1,122
Then(/^I configure Vigia with the following options:$/) do |config_table| @stderr = StringIO.new @stdout = StringIO.new Vigia.configure do |config| config_table.rows_hash.each do |name, value| if name == 'source_file' config.send("#{ name }=", File.join(__dir__, '../support/examples', value)) ...
github
nogates/vigia
https://github.com/nogates/vigia
features/step_definitions/rspec.rb
Ruby
mit
95
master
765
Then(/^I run Vigia$/) do Vigia.rspec! @stdout.rewind @stderr.rewind @vigia_stdout = @stdout.read @vigia_stderr = @stderr.read RSpec.reset end Then(/^the output should contain the following:$/) do |text| real_text = text.gsub('{SOURCE_FILE}', Vigia::Rspec.adapter.source_file) expect(@vigia_stdout).to ma...
github
nogates/vigia
https://github.com/nogates/vigia
features/support/env.rb
Ruby
mit
95
master
541
require 'simplecov' require 'pry' require 'vigia' Before('@my_blog') do @running_apps ||= {} unless @running_apps.has_key?('my_blog') my_blog = Vigia::Examples::MyBlog.new my_blog.start_server @running_apps['my_blog'] = my_blog end end RSpec::Matchers.define :match_vigia_output do |output| match d...
github
nogates/vigia
https://github.com/nogates/vigia
features/support/examples/my_blog.rb
Ruby
mit
95
master
637
module Vigia module Examples class MyBlog def start_server @server = Vigia::Examples::Server.new @server.app = app @server.async.start! wait_until(app_started?) end def stop_server app.quit! wait_until(app_stopped?) @server.terminate! ...
github
nogates/vigia
https://github.com/nogates/vigia
features/support/examples/my_blog/data.rb
Ruby
mit
95
master
1,128
module Vigia module Examples class MyBlog class Data POST_1 = { slug: 'my-awesome-first-post', title: 'My awesome first post', body: 'Here is my post. It is a short one!' } POSTS = [ POST_1 ] COMMENT_1 = { title: 'Lurker', ...
github
nogates/vigia
https://github.com/nogates/vigia
features/support/examples/my_blog/app.rb
Ruby
mit
95
master
1,662
require 'sinatra/base' require 'json' module Vigia module Examples class MyBlog class App < Sinatra::Base set :server, 'webrick' before do content_type 'application/json' end get '/posts' do status 200 Vigia::Examples::MyBlog::Data['/posts']....
github
nogates/vigia
https://github.com/nogates/vigia
spec/support/shared_examples/redsnow_doubles.rb
Ruby
mit
95
master
3,422
shared_examples "redsnow doubles" do let(:resource) do instance_double( RedSnow::Resource, name: resource_name, description: resource_description, parameters: resource_parameters, uri_template: resource_uri_template, model: resource_model ) end let(:...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/vigia_spec.rb
Ruby
mit
95
master
2,671
require 'spec_helper' describe Vigia do describe '::rspec!' do let(:rspec) do instance_double(Vigia::Rspec, run!: nil) end let(:config) do instance_double(Vigia::Config, validate!: true) end before do allow(Vigia::Rspec).to receive(:new).and_return(rspec) allow(Vigia).t...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/config_spec.rb
Ruby
mit
95
master
3,053
require 'spec_helper' describe Vigia::Config do include_examples "redsnow doubles" describe '::initialize' do context 'when accessing properties' do it 'has an source_file getter with default value' do expect(subject.source_file).to be(nil) end it 'has a custom_examples_paths getter...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/url_spec.rb
Ruby
mit
95
master
1,647
require 'spec_helper' describe Vigia::Url do include_examples "redsnow doubles" let(:parameters) do instance_double( Vigia::Parameters, to_hash: parameters_hash ) end let(:parameters_hash) do [ { name: 'scenario_slug', value: 'scenario_one', required: true }, { name: 'pag...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/adapter_spec.rb
Ruby
mit
95
master
3,117
require 'spec_helper' describe Vigia::Adapter do let(:config) do instance_double( Vigia::Config, source_file: source_file ) end let(:source_file) { 'a file' } let(:template) { -> { 'a template proc' } } before do allow(Vigia).to receive(:config).and_return(config) allow(descri...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/rspec_spec.rb
Ruby
mit
95
master
1,433
require 'spec_helper' describe Vigia::Rspec do let(:config) do instance_double( Vigia::Config, stdout: stdout, stderr: stderr, rspec_config_block: nil ) end let(:stdout) { $stdout } let(:stderr) { $stderr } before do allow(Vigia).to receive(:config).and_return(config) e...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/utils_spec.rb
Ruby
mit
95
master
901
require 'spec_helper' require_relative '../../lib/vigia/spec/support/utils' describe 'Utils methods' do describe '#format_error' do let(:result) { instance_double(Hash, inspect: 'Inspecting Result') } let(:expectation) { instance_double(Hash, inspect: 'Inspecting Expectation') } context 'while fo...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/parameters_spec.rb
Ruby
mit
95
master
1,218
require 'spec_helper' describe Vigia::Parameters do let(:parameters) do [ { name: 'scenario_slug', value: 'scenario_one', required: true }, { name: 'page', value: 3, required: false } ] end subject do described_class.new parameters end describe '#initialize' do it 'creates a ne...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/formatter_spec.rb
Ruby
mit
95
master
966
require 'spec_helper' describe Vigia::Formatter do let(:output) { double } let(:notification) { double } subject do described_class.new(output) end describe '#example_pending' do after do subject.example_pending(notification) end it 'calls output_example_result with the right ...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/hooks_spec.rb
Ruby
mit
95
master
879
require 'spec_helper' class Hookeable include Vigia::Hooks end describe Hookeable do let(:config) do instance_double( Vigia::Config, hooks: config_hooks ) end before do allow(subject).to receive(:options).and_return(options) allow(Vigia).to receive(:config).and_return(config) en...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/sail/rspec_object_spec.rb
Ruby
mit
95
master
2,977
require 'spec_helper' describe Vigia::Sail::RSpecObject do let(:options) { double(:'[]' => nil) } let(:rspec_context) { double(described_class: testing_described_class) } let(:testing_described_class) { double } subject do described_class.new :name, options, rspec_context end ...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/sail/context_spec.rb
Ruby
mit
95
master
2,854
require 'spec_helper' describe Vigia::Sail::Context do let(:options) { { } } let(:rspec_context) { double(described_class: testing_described_class) } let(:testing_described_class) { double } subject do described_class.new :example_context, options, rspec_context end descri...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/sail/example_spec.rb
Ruby
mit
95
master
5,201
require 'spec_helper' describe Vigia::Sail::Example do let(:options) { { } } let(:rspec_context) { double(described_class: testing_described_class) } let(:testing_described_class) { double } describe '::example_contexts_include?' do let(:context) { double(options: context_options, name: co...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/sail/examples/default_spec.rb
Ruby
mit
95
master
2,643
require 'spec_helper' describe 'Vigia default examples' do before do Vigia::Sail::Examples::Default.load! end let(:expectations) { double } let(:result) { double } describe 'code_match' do subject do Vigia::Sail::Example.collection[:code_match] end context 'when the code is a r...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/http_client/rest_client_spec.rb
Ruby
mit
95
master
2,281
require 'spec_helper' describe Vigia::HttpClient::RestClient do let(:http_options) { {} } subject do described_class.new(http_options) end describe '#run!' do let(:http_options) { { http_options: 'the options' } } it 'calls #perform_request' do expect(subject).to receive(:perform_request) ...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/http_client/options_spec.rb
Ruby
mit
95
master
894
require 'spec_helper' describe Vigia::HttpClient::Options do let(:config) do instance_double( Vigia::Config, headers: config_headers ) end let(:context) do instance_double( Vigia::Sail::Context ) end let(:let_context) { double } let(:headers) { {} } before do al...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/adapters/blueprint_spec.rb
Ruby
mit
95
master
5,925
require 'spec_helper' describe Vigia::Adapters::Blueprint do include_examples 'redsnow doubles' let(:config) do instance_double( Vigia::Config, source_file: 'my_blueprint_file' ) end before do allow(Vigia).to receive(:config).and_return(config) end describe '::setup_adapter' do ...
github
nogates/vigia
https://github.com/nogates/vigia
spec/lib/adapters/raml_spec.rb
Ruby
mit
95
master
7,463
require 'spec_helper' describe Vigia::Adapters::Raml do let(:config) do instance_double( Vigia::Config, source_file: 'my_raml_file' ) end before do Vigia.reset! allow(Vigia).to receive(:config).and_return(config) end describe 'adapter structure' do context 'testing an insta...
github
infinitered/ruby-xcdm
https://github.com/infinitered/ruby-xcdm
ruby-xcdm.gemspec
Ruby
mit
94
master
1,085
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'xcdm/version' Gem::Specification.new do |spec| spec.name = "ruby-xcdm" spec.version = XCDM::VERSION spec.authors = ["Ken Miller"] spec.email = ["ken@infiniter...