Skip to content

Commit 8d484bd

Browse files
committed
Add comments to specs
1 parent 79611fe commit 8d484bd

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

lib/active_record/virtual_attributes/virtual_delegates.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ def define_delegate(method_name, method, to: nil, allow_nil: nil, default: nil)
8181
# On the other hand it could be that the target has side-effects,
8282
# whereas conceptually, from the user point of view, the delegator should
8383
# be doing one call.
84+
# NOTE: This is based upon ActiveSupport 6.0 delegate.rb, but we added has_attribute? and default
8485
if allow_nil
8586
method_def = <<-METHOD
8687
def #{method_name}(#{definition})

spec/db/models.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class VirtualTotalTestBase < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
1+
class VirtualTotalTestBase < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
22
self.abstract_class = true
33

44
include VirtualFields

spec/support/with_test_class.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#
1414
RSpec.shared_context 'with test_class', :with_test_class do
1515
before do
16-
class TestClassBase < ActiveRecord::Base
16+
class TestClassBase < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
1717
self.abstract_class = true
1818

1919
include VirtualFields

spec/virtual_attributes_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
end
209209

210210
context "add_virtual_reflection integration" do
211-
it "with invalid parameters" do
211+
it "expects an association name" do
212212
expect { TestClass.virtual_has_one }.to raise_error(ArgumentError)
213213
end
214214

@@ -218,17 +218,17 @@
218218
expect(TestClass.virtual_reflection(:vref1).name).to eq(:vref1)
219219
end
220220

221-
it("with has_one macro") do
221+
it "with has_one macro" do
222222
TestClass.virtual_has_one(:vref1)
223223
expect(TestClass.virtual_reflection(:vref1).macro).to eq(:has_one)
224224
end
225225

226-
it("with has_many macro") do
226+
it "with has_many macro" do
227227
TestClass.virtual_has_many(:vref1)
228228
expect(TestClass.virtual_reflection(:vref1).macro).to eq(:has_many)
229229
end
230230

231-
it("with belongs_to macro") do
231+
it "with belongs_to macro" do
232232
TestClass.virtual_belongs_to(:vref1)
233233
expect(TestClass.virtual_reflection(:vref1).macro).to eq(:belongs_to)
234234
end

0 commit comments

Comments
 (0)