Given following log snippets, their explanation, and nothing else, explain what failure, if any, occurred during build of this package.

  Snippets are in a format of [X] : [Y], where [X] is a log snippet, and [Y] is the explanation.

  Snippets are delimited with '================'.

  Drawing on information from all snippets, provide a concise explanation of the issue and recommend a solution.

  Explanation of the issue, and recommended solution, should take a handful of sentences.

  Snippets:

  [Checking for unpackaged file(s): /usr/lib/rpm/check-files /builddir/build/BUILDROOT/rubygem-rails-7.0.8.6-1.el9.x86_64


RPM build errors:
error: Installed (but unpackaged) file(s) found:
   /usr/share/gems/gems/rails-7.0.8.6/MIT-LICENSE
    Installed (but unpackaged) file(s) found:
   /usr/share/gems/gems/rails-7.0.8.6/MIT-LICENSE
]: [This is check at the end of rpmbuild that failed and as a consequence failed the whole build.]

Issue: During %install phase you or some script installed MIT-LICENSE file to %{buildroot} directory. But this file is neither listed in %files section nor excluded in %files section.
Resolution: This file seems to be important and you should include it in final %files section. Put there:

%files
%license %{gem_instdir}/MIT-LICENSE

Alternatively it may be good idea to move the license file to %{gem_docdir} and use this path in %files section.