Class: Cucumber::Formatter::PublishBannerPrinter
- Inherits:
-
Object
- Object
- Cucumber::Formatter::PublishBannerPrinter
- Includes:
- Term::Banner
- Defined in:
- lib/cucumber/formatter/publish_banner_printer.rb
Instance Method Summary collapse
- #display_publish_ad(io) ⇒ Object
- #highlight(text) ⇒ Object
-
#initialize(configuration) ⇒ PublishBannerPrinter
constructor
A new instance of PublishBannerPrinter.
- #link(text) ⇒ Object
- #pre(text) ⇒ Object
Methods included from Term::Banner
Constructor Details
#initialize(configuration) ⇒ PublishBannerPrinter
Returns a new instance of PublishBannerPrinter.
10 11 12 13 14 15 16 |
# File 'lib/cucumber/formatter/publish_banner_printer.rb', line 10 def initialize(configuration) return if configuration.publish_enabled? configuration.on_event :test_run_finished do |_event| display_publish_ad(configuration.error_stream) end end |
Instance Method Details
#display_publish_ad(io) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/cucumber/formatter/publish_banner_printer.rb', line 18 def display_publish_ad(io) ( [ [ 'Share your Cucumber Report with your team at ', link('https://reports.cucumber.io') ], '', [ 'Command line option: ', highlight('--publish') ], [ 'Environment variable: ', highlight('CUCUMBER_PUBLISH_ENABLED'), '=', highlight('true') ], [ 'cucumber.yml: ', highlight('default: --publish') ], '', [ 'More information at ', link('https://cucumber.io/docs/cucumber/environment-variables/') ], '', [ 'To disable this message, specify ', pre('CUCUMBER_PUBLISH_QUIET=true'), ' or use the ' ], [ pre('--publish-quiet'), ' option. You can also add this to your ', pre('cucumber.yml:') ], [pre('default: --publish-quiet')] ], io ) end |
#highlight(text) ⇒ Object
62 63 64 |
# File 'lib/cucumber/formatter/publish_banner_printer.rb', line 62 def highlight(text) [text, :cyan] end |
#link(text) ⇒ Object
66 67 68 |
# File 'lib/cucumber/formatter/publish_banner_printer.rb', line 66 def link(text) [text, :cyan, :bold, :underline] end |
#pre(text) ⇒ Object
70 71 72 |
# File 'lib/cucumber/formatter/publish_banner_printer.rb', line 70 def pre(text) [text, :bold] end |