Skip to content

Commit

Permalink
WIP Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrocha committed Nov 19, 2024
1 parent 8cfe769 commit ff9ccec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions spec/tapioca/cli/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,7 @@ def self.gather_constants

it "generates RBIs for lower versions of activerecord-typedstore" do
@project.require_real_gem("activerecord-typedstore", "1.4.0")
@project.require_real_gem("sqlite3", "1.7.3")
@project.require_real_gem("sqlite3", "~> 2.1")
@project.bundle_install!
@project.write!("lib/post.rb", <<~RB)
require "active_record"
Expand Down Expand Up @@ -2206,7 +2206,7 @@ class Tapioca::Dsl::Compilers::ActiveRecordRelations

@project.require_mock_gem(foo)
@project.require_real_gem("activerecord", require: "active_record")
@project.require_real_gem("sqlite3", "1.7.3")
@project.require_real_gem("sqlite3", "~> 2.1")
@project.bundle_install!

result = @project.tapioca("dsl Post")
Expand Down Expand Up @@ -3018,7 +3018,7 @@ class Application < Rails::Application
describe "options for built-in compilers" do
it "is able to pass 'untyped' to ActiveRecordColumns compiler" do
@project.require_real_gem("activerecord")
@project.require_real_gem("sqlite3", "1.7.3")
@project.require_real_gem("sqlite3", "~> 2.1")
@project.bundle_install!
@project.write!("lib/post.rb", <<~RB)
require "active_record"
Expand Down
10 changes: 8 additions & 2 deletions spec/tapioca/cli/gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,12 @@ class Post

res = @project.tapioca("gem foo")

expected_callbacks = if RUBY_VERSION >= "3.2"
"def __callbacks; end\n def __callbacks=(new_value); end"
else
"def __callbacks; end"
end

assert_project_file_equal("sorbet/rbi/gems/[email protected]", <<~RBI)
# typed: true
Expand All @@ -1269,7 +1275,7 @@ module Foo; end
class Foo::Engine < ::Rails::Engine
class << self
def __callbacks; end
#{expected_callbacks}
end
end
Expand All @@ -1281,7 +1287,7 @@ class User; end
end

it "does not crash while tracking `rbtrace` constants" do
@project.require_real_gem("rbtrace", "0.4.14")
@project.require_real_gem("rbtrace", "0.5.1")
@project.bundle_install!
result = @project.tapioca("gem rbtrace")
assert_empty_stderr(result)
Expand Down

0 comments on commit ff9ccec

Please sign in to comment.