deployagram-rspec 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +14 -0
  3. data/README.md +9 -0
  4. data/lib/deployagram/rspec.rb +61 -0
  5. metadata +77 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5aa8b07bb66d31726b1551b6e2a11698408e57f4f6df6b894e96a7264eba6a18
4
+ data.tar.gz: 378b79af93dc79a2cf7af7e94c75870f08f30938ad75732130ee5128daa1e042
5
+ SHA512:
6
+ metadata.gz: bdabcc186228db772259f3d7f000648ab067d23afa501518e9cc4aa7eaa2253f6ff99c7d315a3ed203c042959c766a4711bb792a1ecd78a07b83cb55e4e187da
7
+ data.tar.gz: ec45e986fa431ede882791c4d02d54295cc18c408b2ea426a581abf5bc7b0e6b7f0ec6a9b5e8fb377577821e60ea458f77eb214d068bcbe44e45762b42525858
data/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ DEPLOYAGRAM PROPRIETARY LICENSE
2
+
3
+ Copyright (c) 2025 Deployagram, Cookiebit and Andy Muir.
4
+
5
+ Permission is hereby granted to use this software solely for its intended purpose.
6
+
7
+ RESTRICTIONS:
8
+ - No modification of the software is permitted
9
+ - No reverse engineering, decompilation, or disassembly
10
+ - No redistribution without explicit written permission
11
+ - Source code remains proprietary and confidential
12
+ - Usage is limited to the compiled npm package (the distributed tarball) artifact only
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
data/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # deployagram-rspec
2
+
3
+ RSpec adapter for Deployagram service tests.
4
+
5
+ Starts the Collector and Proxy once per run, posts the Proxy configuration before each example, and ends each example's sequence diagram. Requires the rspec gem.
6
+
7
+ Depends on: `deployagram-environment`, `deployagram-core`.
8
+
9
+ Part of the Deployagram Ruby packages. See `../../README.md`.
@@ -0,0 +1,61 @@
1
+ require "rspec/core"
2
+ require "deployagram/environment"
3
+ require "deployagram/proxy_config"
4
+
5
+ module Deployagram
6
+ # RSpec adapter. Call Deployagram::RSpec.install from spec_helper.rb. It starts the Collector and
7
+ # Proxy once per run (before(:suite)), posts the Proxy configuration before each example, and ends
8
+ # each example's sequence diagram after it (after(:each)). Names are "<file>.<example description>".
9
+ module RSpec
10
+ class << self
11
+ # proxy_config: the Proxy settings for this suite, as a Hash of string keys and values.
12
+ # proxy: false for a suite with no Proxy. logger_environment: extra variables for a Collector this run starts.
13
+ def install(config, proxy_config: {}, proxy: true, logger_environment: {})
14
+ suite = Suite.new(proxy_config: proxy_config, proxy: proxy, logger_environment: logger_environment)
15
+
16
+ config.before(:suite) { Deployagram::RSpec.suite = suite.start }
17
+ config.after(:suite) { suite.stop }
18
+
19
+ config.before(:each) do |example|
20
+ ProxyConfig.post(Deployagram::RSpec.suite.environment.proxy.url, proxy_config) if proxy && !proxy_config.empty?
21
+ end
22
+
23
+ config.after(:each) do |example|
24
+ Deployagram::RSpec.suite.environment.logger_client.mark_end(Deployagram::RSpec.marker_for(example))
25
+ end
26
+ end
27
+
28
+ attr_accessor :suite
29
+
30
+ def marker_for(example)
31
+ file = File.basename(example.metadata[:file_path].to_s, ".rb")
32
+ "#{file}.#{example.full_description}"
33
+ end
34
+ end
35
+
36
+ # Holds the environment for the run. Starts it once, and stops only what it started.
37
+ class Suite
38
+ attr_reader :environment
39
+
40
+ def initialize(proxy_config:, proxy:, logger_environment:)
41
+ @proxy_config = proxy_config
42
+ @proxy = proxy
43
+ @logger_environment = logger_environment
44
+ end
45
+
46
+ def start
47
+ @environment ||= Environment.start(
48
+ proxy: @proxy,
49
+ proxy_config: @proxy_config,
50
+ logger_environment: @logger_environment,
51
+ )
52
+ self
53
+ end
54
+
55
+ def stop
56
+ @environment&.stop
57
+ @environment = nil
58
+ end
59
+ end
60
+ end
61
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: deployagram-rspec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Deployagram
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: deployagram-environment
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ -
17
+ - "="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ -
25
+ - "="
26
+ - !ruby/object:Gem::Version
27
+ version: 0.1.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: deployagram-core
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ -
33
+ - "="
34
+ - !ruby/object:Gem::Version
35
+ version: 0.1.0
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ -
41
+ - "="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.1.0
44
+ description: "Starts the Collector and Proxy once per run, posts the Proxy configuration before each example, and ends each example's sequence diagram. Requires the rspec gem."
45
+ email:
46
+ - andy@deployagram.com
47
+ executables: []
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - LICENSE
52
+ - README.md
53
+ - lib/deployagram/rspec.rb
54
+ licenses:
55
+ - SEE LICENSE IN LICENSE
56
+ metadata:
57
+ rubygems_mfa_required: "true"
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ -
64
+ - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "3.2"
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ -
70
+ - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
73
+ requirements: []
74
+ rubygems_version: 4.1.0
75
+ specification_version: 4
76
+ summary: RSpec adapter for Deployagram service tests
77
+ test_files: []