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
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
inherit_from: .rubocop_todo.yml

Layout/EndOfLine:
EnforcedStyle: lf
7 changes: 7 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-09-28 18:58:27 -0400 using RuboCop version 0.50.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
14 changes: 14 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

source 'https://rubygems.org'

git_source(:github) { 'https://github.com/sphinix27/notifier_api_test' }

gem 'cucumber'
gem 'faraday'
gem 'json'
gem 'json_spec'
gem 'pg'
gem 'report_builder'
gem 'rspec'
gem 'rubocop', '~> 0.50.0', require: false
76 changes: 76 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.3.0)
builder (3.2.3)
cucumber (2.4.0)
builder (>= 2.1.2)
cucumber-core (~> 1.5.0)
cucumber-wire (~> 0.0.1)
diff-lcs (>= 1.1.3)
gherkin (~> 4.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.2)
cucumber-core (1.5.0)
gherkin (~> 4.0)
cucumber-wire (0.0.1)
diff-lcs (1.3)
faraday (0.13.1)
multipart-post (>= 1.2, < 3)
gherkin (4.1.3)
json (2.0.2)
json_spec (1.1.5)
multi_json (~> 1.0)
rspec (>= 2.0, < 4.0)
multi_json (1.12.2)
multi_test (0.1.2)
multipart-post (2.0.0)
parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
pg (0.21.0-x64-mingw32)
powerpack (0.1.1)
rainbow (2.2.2)
rake
rake (12.1.0)
report_builder (0.1.6)
builder (~> 3.2, >= 3.2.2)
json (>= 1.8.1)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-mocks (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
rubocop (0.50.0)
parallel (~> 1.10)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
unicode-display_width (1.3.0)

PLATFORMS
x64-mingw32

DEPENDENCIES
cucumber
faraday
json
json_spec
pg
report_builder
rspec
rubocop (~> 0.50.0)

BUNDLED WITH
1.15.4
Empty file.
43 changes: 43 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
require 'pathname'
require 'yaml'

def find_config_file(filename)
root = Pathname.pwd
until root.root?
root.find do |path|
return path.to_s if path.file? && path.basename.to_s == filename
end
root = root.parent
end
raise 'Configuration file '
end

def load_app_config_file(filename)
config_file = find_config_file(filename)
config = YAML.load_file(config_file)
$app_context = config['app']['rootPath']
config
end

def load_bd_config_file(filename)
config_file = find_config_file(filename)
config_bd = YAML.load_file(config_file)
$bd_context = config_bd['database']['connection']
config_bd
end

AfterConfiguration do
# read config file
configuration = load_app_config_file('env.yml')
configuration_bd = load_bd_config_file('env.yml')
# Load application configuration parameters
$app_host = configuration['app']['host']
$app_port = configuration['app']['port']
$app_root = configuration['app']['rootPath']
$bd_connection = configuration_bd['database']['connection']
$bd_host = configuration_bd['database']['host']
$bd_port = configuration_bd['database']['port']
$bd_database = configuration_bd['database']['database']
$bd_username = configuration_bd['database']['username']
$bd_password = configuration_bd['database']['password']
end
12 changes: 12 additions & 0 deletions features/support/env.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
app:
host:
port:
rootPath:

database:
connection:
host:
port:
database:
username:
password:
12 changes: 12 additions & 0 deletions features/support/env_yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
app:
host: http://12.43.3.94
port: 8080
rootPath: /api/v2

database:
connection: postgres
host: 127.0.0.1
port: 3306
database: home
username: username
password: secret
11 changes: 11 additions & 0 deletions features/support/utils/database_manager.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'pg'
# Conect to Database
module DatabaseManager
def self.conn
PG.connect host: $bd_host,
port: $bd_port,
dbname: $bd_database,
user: $bd_username,
password: $bd_password
end
end
12 changes: 12 additions & 0 deletions features/support/utils/response_manager.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'json'

# Manage the conversion of hashes and string to json
module ResponseManager
def hash_to_json(hash)
hash.to_json
end

def string_to_json(string)
JSON.parse string
end
end