Skip to content

Commit

Permalink
Increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherRegularDude committed Nov 13, 2023
1 parent 3b670c0 commit c373f43
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/resol/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ def method_missing(meth, *args, &block)
if smartcore_config && smartcore_config.respond_to?(meth)
# rubocop:enable Style/SafeNavigation
smartcore_config.__send__(meth, *args, &block)
elsif ::Kernel.method_defined?(meth) || ::Kernel.private_method_defined?(meth)
::Kernel.instance_method(meth).bind_call(self, *args, &block)
else
super(meth, *args, &block)
end
Expand Down
20 changes: 20 additions & 0 deletions spec/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,24 @@
expect(SmartCore::Initializer::Configuration.config[:auto_cast]).to eq(false)
expect(described_class.return_engine).to eq(Resol::ReturnEngine::Return)
end

context "when undefined method is called" do
let(:called_block) do
proc do
described_class.configure do |c|
c.not_exist = true
end
end
end

it "raises error" do
expect(&called_block).to raise_error(NoMethodError)
end
end

context "with undefined method" do
it "respond_to? returns false" do
expect(described_class.respond_to?(:not_exist)).to eq(false)
end
end
end

0 comments on commit c373f43

Please sign in to comment.