Skip to content

Commit

Permalink
fix rubocop offenses
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammednasser-32 committed Aug 30, 2024
1 parent 6a63eea commit 86c4370
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions spec/acceptance/callbacks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,24 +251,24 @@ def name
end

describe "before build callback" do
class TitleSetter
def self.title=(new_title)
@@title = new_title
end
before do
define_class("TitleSetter") do
def self.title=(new_title)
class_variable_set(:@@title, new_title)
end

def self.title
@@title
def self.title
class_variable_get(:@@title)
end
end
end

before do
define_model("Article", title: :string)

FactoryBot.define do
factory :article_with_before_callbacks, class: :article do
before(:build) { TitleSetter.title = "title from before build" }
after(:build) { TitleSetter.title = "title from after build" }

title { TitleSetter.title }
end
end
Expand Down

0 comments on commit 86c4370

Please sign in to comment.