Skip to content
Open
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# rspec failure tracking
.rspec_status

Gemfile.lock
.idea/
.DS_Store
.byebug_history
Expand Down
49 changes: 49 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
PATH
remote: .
specs:
client-api (0.4.1)
json-schema (~> 2.8)
logger (~> 1.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
byebug (11.0.1)
diff-lcs (1.3)
dogapi (1.39.0)
multi_json
json-schema (2.8.1)
addressable (>= 2.4)
logger (1.4.1)
multi_json (1.14.1)
public_suffix (4.0.1)
rake (13.0.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.0)
rspec-support (~> 3.9.0)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)

PLATFORMS
ruby

DEPENDENCIES
bundler
byebug (~> 11.0)
client-api!
dogapi
rake
rspec (~> 3.0)

BUNDLED WITH
2.0.2
1 change: 1 addition & 0 deletions client-api.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "byebug", "~> 11.0"
spec.add_development_dependency "dogapi"

spec.add_runtime_dependency "json-schema", '~> 2.8'
spec.add_runtime_dependency "logger", "~> 1.0"
Expand Down
32 changes: 32 additions & 0 deletions spec/client/dd_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
describe 'http(s) validation', :focus do

it "http scheme validator", :get do
api = ClientApi::Api.new
api.get('http://jservice.io/api/categories', {"Accept"=>"*/*"})
end

it "http scheme validator x2", :get do
api = ClientApi::Api.new
api.get('http://jservice.io/api/categories', {"Accept"=>"*/*"})
expect(api.status).to eq(200)
end

it "http scheme validator x3", :get do
api = ClientApi::Api.new
api.get('http://jservice.io/api/categories', {"Accept"=>"*/*"})
expect(api.status).to eq(201)
end

it "http scheme validator x4", :get do
api = ClientApi::Api.new
api.get('http://jservice.io/api/categories', {"Accept"=>"*/*"})
expect(api.status).to eq(202)
end

it "http scheme validator x5", :get do
api = ClientApi::Api.new
api.get('http://jservice.io/api/categories', {"Accept"=>"*/*"})
expect(api.status).to eq(200)
end

end
35 changes: 35 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
require "rspec"
require "rspec/expectations"
require "json"
require "dogapi"
require "byebug"

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
Expand All @@ -17,6 +19,9 @@

config.filter_run_when_matching :focus
config.expose_dsl_globally = true

$data ||= []
$passed = $failed = $pending = 0
end

ClientApi.configure do |config|
Expand All @@ -30,4 +35,34 @@
config.before(:each) do |scenario|
ClientApi::Request.new(scenario)
end

config.after(:each) do |scenario|
if (scenario.exception) && (!scenario.exception.message.include? 'pending')
status_id = 0
elsif scenario.skipped?
status_id = 2
elsif scenario.pending?
status_id = 2
else
status_id = 1
end

$data << {'status_id' => status_id, 'scenario' => scenario.description}
end

config.after(:all) do
$data.map do |value|
$failed += 1 if value['status_id'] == 0
$passed += 1 if value['status_id'] == 1
$pending += 1 if value['status_id'] == 2
end

dog = Dogapi::Client.new(ENV['API_KEY'], ENV['APP_KEY'])
dog.batch_metrics do
dog.emit_point('qa.baseline.website.passed',$passed)
dog.emit_point('qa.baseline.website.failed', $failed)
dog.emit_point('qa.baseline.website.pending', $pending)
end
end

end