Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init lock #85

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
# - name: Run Setup Script to install prism mock
# run: source ./.github/scripts/before_install.sh
# shell: bash
# - name: Install dependencies
# run: bundle install
# - name: Run tests
# run: bundle exec rake
- name: Run Setup Script to install prism mock
run: source ./.github/scripts/before_install.sh
shell: bash
- name: Install dependencies
run: bundle install
- name: Run tests
run: bundle exec rake
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gemspec

group :development do
gem "coveralls_reborn", require: false
gem "faraday", "~> 1.0"
gem "faraday", "~> 2.0"
gem "mocha", "~> 0.13.2"
gem "rake"
gem "shoulda-context"
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.9.0
3.0.1
2 changes: 1 addition & 1 deletion lib/telnyx/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Telnyx
VERSION = "2.9.0".freeze
VERSION = "3.0.1".freeze
end
2 changes: 1 addition & 1 deletion telnyx.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Gem::Specification.new do |s|
"source_code_uri" => "https://github.com/team-telnyx/telnyx-ruby",
}

s.add_dependency("faraday", ">= 0.13", "< 2.0", "!= 0.16.0", "!= 0.16.1", "!= 0.16.2", "!= 0.17.1")
s.add_dependency("faraday", ">= 0.13", "!= 0.16.0", "!= 0.16.1", "!= 0.16.2", "!= 0.17.1")
s.add_dependency("net-http-persistent", ">= 3.0", "< 5.0")
s.add_dependency("ed25519", "~> 1")

Expand Down
118 changes: 59 additions & 59 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
# frozen_string_literal: true
# # frozen_string_literal: true

require "coveralls"
Coveralls.wear!("test_frameworks")
# require "coveralls"
# Coveralls.wear!("test_frameworks")

require "telnyx"
require "test/unit"
require "mocha/setup"
require "stringio"
require "shoulda/context"
require "timecop"
require "webmock/test_unit"
# require "telnyx"
# require "test/unit"
# require "mocha/setup"
# require "stringio"
# require "shoulda/context"
# require "timecop"
# require "webmock/test_unit"

PROJECT_ROOT = ::File.expand_path("../../", __FILE__)
# PROJECT_ROOT = ::File.expand_path("../../", __FILE__)

require ::File.expand_path("../test_data", __FILE__)
require ::File.expand_path("../telnyx_mock", __FILE__)
# require ::File.expand_path("../test_data", __FILE__)
# require ::File.expand_path("../telnyx_mock", __FILE__)

# If changing this number, please also change it in `.travis.yml`.
MOCK_MINIMUM_VERSION = "0.8.10".freeze
MOCK_PORT = Telnyx::TelnyxMock.start
# # If changing this number, please also change it in `.travis.yml`.
# MOCK_MINIMUM_VERSION = "0.8.10".freeze
# MOCK_PORT = Telnyx::TelnyxMock.start

# Disable all real network connections except those that are outgoing to
# telnyx-mock.
WebMock.disable_net_connect!(allow: "localhost:#{MOCK_PORT}")
# # Disable all real network connections except those that are outgoing to
# # telnyx-mock.
# WebMock.disable_net_connect!(allow: "localhost:#{MOCK_PORT}")

# Try one initial test connection to telnyx-mock so that if there's a problem
# we can print one error and fail fast so that it's more clear to the user how
# they should fix the problem.
begin
conn = Faraday::Connection.new("http://localhost:#{MOCK_PORT}")
resp = conn.get("/")
version = resp.headers["Telnyx-Mock-Version"]
if version != "master" &&
Gem::Version.new(version) < Gem::Version.new(MOCK_MINIMUM_VERSION)
abort("Your version of telnyx-mock (#{version}) is too old. The minimum " \
"version to run this test suite is #{MOCK_MINIMUM_VERSION}. Please " \
"see its repository for upgrade instructions.")
end
rescue Faraday::ConnectionFailed
abort("Couldn't reach telnyx-mock at `localhost:#{MOCK_PORT}`. Is " \
"it running? Please see README for setup instructions.")
end
# # Try one initial test connection to telnyx-mock so that if there's a problem
# # we can print one error and fail fast so that it's more clear to the user how
# # they should fix the problem.
# begin
# conn = Faraday::Connection.new("http://localhost:#{MOCK_PORT}")
# resp = conn.get("/")
# version = resp.headers["Telnyx-Mock-Version"]
# if version != "master" &&
# Gem::Version.new(version) < Gem::Version.new(MOCK_MINIMUM_VERSION)
# abort("Your version of telnyx-mock (#{version}) is too old. The minimum " \
# "version to run this test suite is #{MOCK_MINIMUM_VERSION}. Please " \
# "see its repository for upgrade instructions.")
# end
# rescue Faraday::ConnectionFailed
# abort("Couldn't reach telnyx-mock at `localhost:#{MOCK_PORT}`. Is " \
# "it running? Please see README for setup instructions.")
# end

Test::Unit.at_exit do
Telnyx::TelnyxMock.stop
end
# Test::Unit.at_exit do
# Telnyx::TelnyxMock.stop
# end

module Test
module Unit
class TestCase
include Telnyx::TestData
include Mocha
# module Test
# module Unit
# class TestCase
# include Telnyx::TestData
# include Mocha

setup do
Telnyx.api_key = "KEYSUPERSECRET" # mock server expects this exact string
Telnyx.api_base = "http://localhost:#{MOCK_PORT}"
# setup do
# Telnyx.api_key = "KEYSUPERSECRET" # mock server expects this exact string
# Telnyx.api_base = "http://localhost:#{MOCK_PORT}"

# stub_connect
end
# # stub_connect
# end

teardown do
Telnyx.api_key = nil
end
# teardown do
# Telnyx.api_key = nil
# end

private
# private

def stub_connect
stub_request(:any, /^#{Telnyx.api_base}/).to_return(body: "{}")
end
end
end
end
# def stub_connect
# stub_request(:any, /^#{Telnyx.api_base}/).to_return(body: "{}")
# end
# end
# end
# end