File tree Expand file tree Collapse file tree 4 files changed +56
-44
lines changed
Expand file tree Collapse file tree 4 files changed +56
-44
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ module AllureCucumber
2121 # @return [String]
2222 class CucumberConfig
2323 include Singleton
24- extend Forwardable
2524
2625 # @return [String] default tms tag prefix
2726 DEFAULT_TMS_PREFIX = "TMS:"
@@ -36,26 +35,6 @@ class CucumberConfig
3635 # @return [String] default story tag prefix
3736 DEFAULT_STORY_PREFIX = "STORY:"
3837
39- def_delegators :@allure_config ,
40- :clean_results_directory ,
41- :clean_results_directory= ,
42- :link_issue_pattern ,
43- :link_issue_pattern= ,
44- :link_tms_pattern ,
45- :link_tms_pattern= ,
46- :logging_level ,
47- :logging_level= ,
48- :logger ,
49- :logger= ,
50- :results_directory ,
51- :results_directory= ,
52- :environment ,
53- :environment= ,
54- :environment_properties ,
55- :environment_properties= ,
56- :categories ,
57- :categories=
58-
5938 attr_writer :tms_prefix ,
6039 :issue_prefix ,
6140 :severity_prefix ,
@@ -96,5 +75,13 @@ def feature_prefix
9675 def story_prefix
9776 @story_prefix || DEFAULT_STORY_PREFIX
9877 end
78+
79+ def method_missing ( method , ...)
80+ @allure_config . respond_to? ( method ) ? @allure_config . send ( method , ...) : super
81+ end
82+
83+ def respond_to_missing? ( method , include_private = false )
84+ @allure_config . respond_to? ( method , include_private ) || super
85+ end
9986 end
10087end
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33describe AllureCucumber do
4+ let ( :cucumber_config ) { AllureCucumber ::CucumberConfig . send ( :new ) }
5+
6+ before do
7+ allow ( Allure ::Config ) . to receive ( :instance ) . and_return ( Allure ::Config . send ( :new ) )
8+ allow ( AllureCucumber ::CucumberConfig ) . to receive ( :instance ) . and_return ( cucumber_config )
9+ end
10+
411 it "returns cucumber configuration" do
512 expect ( AllureCucumber . configuration ) . to be_a ( AllureCucumber ::CucumberConfig )
613 end
714
815 it "yields cucumber configuration" do
9- expect { |b | AllureCucumber . configure ( &b ) } . to yield_with_args ( AllureCucumber ::CucumberConfig . instance )
16+ expect { |b | AllureCucumber . configure ( &b ) } . to yield_with_args ( cucumber_config )
17+ end
18+
19+ it "supports common configuration options" do
20+ AllureCucumber . configure { |config | config . failure_exception = StandardError }
21+
22+ expect ( AllureCucumber . configuration . failure_exception ) . to eq ( StandardError )
23+ end
24+
25+ it "supports cucumber specific configuration options" do
26+ AllureCucumber . configure { |config | config . tms_prefix = "TMS" }
27+
28+ expect ( AllureCucumber . configuration . tms_prefix ) . to eq ( "TMS" )
1029 end
1130end
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ module AllureRspec
2121 # @return [String]
2222 class RspecConfig
2323 include Singleton
24- extend Forwardable
2524
2625 # @return [Symbol] default tms tag
2726 DEFAULT_TMS_TAG = :tms
@@ -36,26 +35,6 @@ class RspecConfig
3635 # @return [Symbol] default story tag
3736 DEFAULT_STORY_TAG = :story
3837
39- def_delegators :@allure_config ,
40- :clean_results_directory ,
41- :clean_results_directory= ,
42- :link_issue_pattern ,
43- :link_issue_pattern= ,
44- :link_tms_pattern ,
45- :link_tms_pattern= ,
46- :logging_level ,
47- :logging_level= ,
48- :logger ,
49- :logger= ,
50- :results_directory ,
51- :results_directory= ,
52- :environment ,
53- :environment= ,
54- :environment_properties ,
55- :environment_properties= ,
56- :categories ,
57- :categories=
58-
5938 def initialize
6039 @allure_config = Allure . configuration
6140 end
@@ -102,5 +81,13 @@ def story_tag
10281 def ignored_tags
10382 @ignored_tags || [ ]
10483 end
84+
85+ def method_missing ( method , ...)
86+ @allure_config . respond_to? ( method ) ? @allure_config . send ( method , ...) : super
87+ end
88+
89+ def respond_to_missing? ( method , include_private = false )
90+ @allure_config . respond_to? ( method , include_private ) || super
91+ end
10592 end
10693end
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33describe AllureRspec do
4+ let ( :rspec_config ) { AllureRspec ::RspecConfig . send ( :new ) }
5+
6+ before do
7+ allow ( Allure ::Config ) . to receive ( :instance ) . and_return ( Allure ::Config . send ( :new ) )
8+ allow ( AllureRspec ::RspecConfig ) . to receive ( :instance ) . and_return ( rspec_config )
9+ end
10+
411 it "returns rspec configuration" do
512 expect ( AllureRspec . configuration ) . to be_a ( AllureRspec ::RspecConfig )
613 end
714
815 it "yields rspec configuration" do
9- expect { |b | AllureRspec . configure ( &b ) } . to yield_with_args ( AllureRspec ::RspecConfig . instance )
16+ expect { |b | AllureRspec . configure ( &b ) } . to yield_with_args ( rspec_config )
17+ end
18+
19+ it "supports common configuration options" do
20+ AllureRspec . configure { |config | config . failure_exception = StandardError }
21+
22+ expect ( AllureRspec . configuration . failure_exception ) . to eq ( StandardError )
23+ end
24+
25+ it "supports rspec specific configuration options" do
26+ AllureRspec . configure { |config | config . tms_tag = "TMS" }
27+
28+ expect ( AllureRspec . configuration . tms_tag ) . to eq ( "TMS" )
1029 end
1130end
You can’t perform that action at this time.
0 commit comments