Skip to content

Commit

Permalink
Reproduce flipper bug
Browse files Browse the repository at this point in the history
When flipper/flipper-active_record version 1.3.1 is included
in the Gemfile, Flipper-related code gets added to the
activerecord gemfile.
  • Loading branch information
egiurleo committed Oct 17, 2024
1 parent d7f42e2 commit af948ff
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/tapioca/cli/gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,21 @@ class Secret; end
assert_success_status(result)
end

it "must not include code from an ActiveSupport.on_load hook in ActiveRecord RBIs" do
@project.require_real_gem("rails", "7.1.0")
# Flipper adds functionality to ActiveRecord via an ActiveSupport.on_load hook
@project.require_real_gem("flipper-active_record", "1.3.1")

@project.bundle_install!
result = @project.tapioca("gem")

assert_empty_stderr(result)
assert_success_status(result)

activerecord_rbi_file = T.must(Dir.glob("#{@project.absolute_path}/sorbet/rbi/gems/activerecord@7.1.0.rbi").first)
refute_includes(File.read(activerecord_rbi_file), "class Flipper")
end

it "must generate multiple gem RBIs" do
foo = mock_gem("foo", "0.0.1") do
write!("lib/foo.rb", FOO_RB)
Expand Down

0 comments on commit af948ff

Please sign in to comment.