Skip to content

Commit 2308e46

Browse files
committed
removed some fairly silly things. Setting the proxy is not a supported activity by any stretch of the imagination
1 parent 2a82eda commit 2308e46

File tree

3 files changed

+3
-24
lines changed

3 files changed

+3
-24
lines changed

lib/zendesk_api/resources.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ class Ticket < Resource
466466

467467
# Proxy to trap array operator usage on custom_field_symbol
468468
class CustomFieldSymbolProxy
469-
def initialize(ticket, _arr)
469+
def initialize(ticket)
470470
@ticket = ticket
471471
@field_array = @ticket.custom_fields || []
472472
end
@@ -510,12 +510,7 @@ def respond_to_missing?(method, include_private = false)
510510
end
511511

512512
def custom_field_symbol
513-
@custom_field_symbol ||= CustomFieldSymbolProxy.new(self, @custom_field_symbol)
514-
end
515-
516-
def custom_field_symbol=(val)
517-
@custom_field_symbol = val
518-
@custom_field_symbol_proxy = CustomFieldSymbolProxy.new(self, @custom_field_symbol)
513+
@custom_field_symbol_proxy ||= CustomFieldSymbolProxy.new(self)
519514
end
520515

521516
def self.cbp_path_regexes

spec/core/resources/custom_field_symbol_proxy_spec.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def t.custom_fields
2323
end
2424
t
2525
end
26-
let(:proxy) { described_class.new(ticket, nil) }
26+
let(:proxy) { described_class.new(ticket) }
2727

2828
describe "[] and []=" do
2929
it "reads a custom field by symbol (existing)" do
@@ -71,16 +71,6 @@ def t.custom_fields
7171
expect(t.custom_field_symbol["foo"]).to eq("abc")
7272
end
7373

74-
it "updates proxy on custom_field_symbol= assignment" do
75-
t = ZendeskAPI::Ticket.new({})
76-
t.instance_variable_set(:@client, client)
77-
def t.custom_fields
78-
_foo = 1
79-
@custom_fields
80-
end
81-
t.custom_field_symbol = [{ id: 1, value: "xyz" }]
82-
expect(t.custom_field_symbol.to_a).to eq([{ id: 1, value: "xyz" }])
83-
end
8474
end
8575

8676
describe "[] and []= with missing ticket_fields_metadata" do

spec/live/ticket_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,6 @@ def valid_attributes
258258
expect(t.custom_field_symbol["foo"]).to eq("abc")
259259
end
260260

261-
it "updates proxy on custom_field_symbol= assignment" do
262-
t = ZendeskAPI::Ticket.allocate
263-
t.instance_variable_set(:@client, client)
264-
t.custom_field_symbol = [{ id: 1, value: "xyz" }]
265-
expect(t.custom_field_symbol.to_a).to eq([{ id: 1, value: "xyz" }])
266-
end
267261
end
268262
end
269263
end

0 commit comments

Comments
 (0)