Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid warnings when redefining methods in tests. #210

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions test/unit/attribute_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
class AttributeTest < ActiveSupport::TestCase
def with_native_limit(type, new_limit)
ActiveRecord::Base.connection.class_eval do
undef :native_database_types
define_method :native_database_types do
super().tap do |types|
types[type][:limit] = new_limit
Expand All @@ -13,6 +14,7 @@ def with_native_limit(type, new_limit)
yield
ensure
ActiveRecord::Base.connection.class_eval do
undef :native_database_types
define_method :native_database_types do
super()
end
Expand Down
2 changes: 2 additions & 0 deletions test/unit/graphviz_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ def find_dot_edge_styles(diagram)
begin
GraphViz.class_eval do
alias_method :old_output_and_errors_from_command, :output_and_errors_from_command
undef :output_and_errors_from_command
def output_and_errors_from_command(*args); raise end
end
assert_nothing_raised do
Diagram::Graphviz.create(:filetype => :dot)
end
ensure
GraphViz.class_eval do
undef :output_and_errors_from_command
alias_method :output_and_errors_from_command, :old_output_and_errors_from_command
end
end
Expand Down