bunyan_capybara 0.1.5 → 0.2.5
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.
- checksums.yaml +4 -4
- data/README.md +23 -5
- data/lib/bunyan_capybara/bunyan_variable_extractor.rb +11 -6
- data/lib/bunyan_capybara/version.rb +1 -1
- data/lib/bunyan_capybara.rb +9 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36511512d64f90b9192559c06c65adb9b0327314
|
4
|
+
data.tar.gz: 7a5f2adccb632a375a622cdfb0dec04ebc76ca27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0d08dab9971559dda8998740801a64b84edfd85bba69bedb4635e7858788950b12b841c64c7cc2eacde98c4bb876c6d022e671c01624527baaa2ca6fb1cc832
|
7
|
+
data.tar.gz: d5eb7657c76340ad8f7361949afeede20177314389f3e550b646bce81e63020ad707976a340728281aec1aaee9489d193df8dd4ecc37502fb655e809bf54d887
|
data/README.md
CHANGED
@@ -28,14 +28,32 @@ Or install it yourself as:
|
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
31
|
-
|
31
|
+
In order to use the bunyan_capybara gem, you musts first add the following to your spec_helper.rb file.
|
32
32
|
|
33
|
+
At the top of your spec_helper add this line...
|
34
|
+
|
35
|
+
$ require 'bunyan_capybara'
|
36
|
+
|
37
|
+
Then, below this, but before your configuration block, add these two lines...
|
38
|
+
|
39
|
+
$ spec_path = File.expand_path('../', __FILE__)
|
40
|
+
$ Bunyan.instantiate_all_loggers!(config: ENV, path: spec_path)
|
41
|
+
|
42
|
+
These will allow the gem to create a bunyan_logs folder in your ~/ directory with a .log file for each of the files and folders in your spec directory.
|
43
|
+
|
44
|
+
Next, either create or update your config.before block to have the following lines...
|
45
|
+
|
46
|
+
$ @current_logger = Bunyan.start(example: rspec_example, config: ENV, test_handler: self)
|
47
|
+
$ Bunyan.current_logger = @current_logger
|
48
|
+
|
49
|
+
Finally, either create or update your config.after block to have the following lines...
|
50
|
+
|
51
|
+
$ @current_logger.stop()
|
52
|
+
$ Bunyan.reset_current_logger!
|
53
|
+
|
54
|
+
Now you are ready to use the Bunyan logger!
|
33
55
|
## Development
|
34
56
|
|
35
57
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
36
58
|
|
37
59
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
|
-
|
39
|
-
## Contributing
|
40
|
-
|
41
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bunyan_capybara.
|
@@ -5,11 +5,16 @@ module BunyanVariableExtractor
|
|
5
5
|
# @return [ExampleStruct] An object that responds to #application_name_under_test and #test_type
|
6
6
|
# @note If we start nesting our specs, this may need to be revisited.
|
7
7
|
def self.call(path:, config:)
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
if path.include?('rspec-core')
|
9
|
+
application_name_under_test = ARGV[0].split('/')[1]
|
10
|
+
BunyanVariable.new(application_name_under_test, "suite", nil, nil)
|
11
|
+
else
|
12
|
+
path_to_spec_directory = File.expand_path('~/git/QA_tests/spec/', __FILE__)
|
13
|
+
spec_sub_directory = path.sub("#{path_to_spec_directory}/", '').split('/')
|
14
|
+
application_name_under_test = spec_sub_directory[0]
|
15
|
+
test_type = spec_sub_directory[1]
|
16
|
+
environment_under_test = config.fetch('ENVIRONMENT', Bunyan::DEFAULT_ENVIRONMENT)
|
17
|
+
BunyanVariable.new(application_name_under_test, test_type, path_to_spec_directory, environment_under_test)
|
18
|
+
end
|
14
19
|
end
|
15
20
|
end
|
data/lib/bunyan_capybara.rb
CHANGED
@@ -157,14 +157,20 @@ module Bunyan
|
|
157
157
|
# Responsible for logging the start of a test
|
158
158
|
# @return [ExampleLogging::ExampleWrapper]
|
159
159
|
def start
|
160
|
-
|
161
|
-
|
160
|
+
if example.description.include?('suite')
|
161
|
+
self
|
162
|
+
else
|
163
|
+
info(context: "BEGIN example", example: example.full_description, location: example.location)
|
164
|
+
self
|
165
|
+
end
|
162
166
|
end
|
163
167
|
|
164
168
|
# Responsible for consistent logging of the end steps of a test
|
165
169
|
# @return [ExampleLogging::ExampleWrapper]
|
166
170
|
def stop
|
167
|
-
|
171
|
+
if !example.description.include?('suite')
|
172
|
+
info(context: "END example", example: example.full_description, location: example.location)
|
173
|
+
end
|
168
174
|
end
|
169
175
|
|
170
176
|
public
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunyan_capybara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Hallwachs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|