@@ -95,6 +95,18 @@ def self.find(_key); end
9595 expect ( ParameterSubstitution . find_tokens ( square_expression , mapping : mapping , context_overrides : context_overrides ) ) . to eq ( [ 'call.start_time' , 'do_a_barrel_roll' ] )
9696 end
9797 end
98+
99+ context 'when context_overrides attempts to override base options' do
100+ it "ignores input override and uses method parameter" do
101+ context_overrides = { input : "<different>" }
102+ expect ( ParameterSubstitution . find_tokens ( expression , context_overrides : context_overrides ) ) . to eq ( [ 'call' , 'do_a_barrel_roll' ] )
103+ end
104+
105+ it "ignores mapping override and uses method parameter" do
106+ context_overrides = { mapping : { 'different' => 'value' } }
107+ expect ( ParameterSubstitution . find_tokens ( expression , mapping : mapping , context_overrides : context_overrides ) ) . to eq ( [ 'call.start_time' , 'do_a_barrel_roll' ] )
108+ end
109+ end
98110 end
99111
100112 context '#find_formatters' do
@@ -119,6 +131,18 @@ def self.find(_key); end
119131 expect ( ParameterSubstitution . find_formatters ( square_expression , mapping : mapping , context_overrides : context_overrides ) ) . to eq ( [ 'blank_if_nil' , 'downcase' ] )
120132 end
121133 end
134+
135+ context 'when context_overrides attempts to override base options' do
136+ it "ignores input override and uses method parameter" do
137+ context_overrides = { input : "<different>" }
138+ expect ( ParameterSubstitution . find_formatters ( expression , context_overrides : context_overrides ) ) . to eq ( [ 'start_time' , 'blank_if_nil' , 'downcase' ] )
139+ end
140+
141+ it "ignores mapping override and uses method parameter" do
142+ context_overrides = { mapping : { 'different' => 'value' } }
143+ expect ( ParameterSubstitution . find_formatters ( expression , mapping : mapping , context_overrides : context_overrides ) ) . to eq ( [ 'blank_if_nil' , 'downcase' ] )
144+ end
145+ end
122146 end
123147
124148 context '#find_warnings' do
@@ -180,6 +204,20 @@ def self.find(_key); end
180204 "Unknown methods 'test1', 'test2' used on parameter 'black'" ] )
181205 end
182206 end
207+
208+ context 'when context_overrides attempts to override base options' do
209+ it "ignores input override and uses method parameter" do
210+ context_overrides = { input : "<different>" }
211+ expect ( ParameterSubstitution . find_warnings ( expression_with_valid_params , mapping : default_mapping , context_overrides : context_overrides ) )
212+ . to eq ( [ ] )
213+ end
214+
215+ it "ignores mapping override and uses method parameter" do
216+ context_overrides = { mapping : { 'bobby' => 'value' , 'bobby2' => 'value' } }
217+ expect ( ParameterSubstitution . find_warnings ( expression_with_bad_params , mapping : { } , context_overrides : context_overrides ) )
218+ . to eq ( [ "Unknown param 'bobby'" , "Unknown param 'bobby2'" ] )
219+ end
220+ end
183221 end
184222 end
185223
0 commit comments