0
0
Fork 0

Fix Lint/ConstantDefinitionInBlock cop (#24763)

This commit is contained in:
Matt Jankowski 2023-05-03 04:32:30 -04:00 committed by GitHub
parent 8b636a29c6
commit 3df665fd23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 120 additions and 118 deletions

View file

@ -3,48 +3,47 @@
require 'rails_helper'
RSpec.describe Remotable do
class Foo
def initialize
@attrs = {}
end
let(:foo_class) do
Class.new do
def initialize
@attrs = {}
end
def [](arg)
@attrs[arg]
end
def [](arg)
@attrs[arg]
end
def []=(arg1, arg2)
@attrs[arg1] = arg2
end
def []=(arg1, arg2)
@attrs[arg1] = arg2
end
def hoge=(arg); end
def hoge=(arg); end
def hoge_file_name; end
def hoge_file_name; end
def hoge_file_name=(arg); end
def hoge_file_name=(arg); end
def has_attribute?(arg); end
def has_attribute?(arg); end
def self.attachment_definitions
{ hoge: nil }
end
end
before do
class Foo
include Remotable
remotable_attachment :hoge, 1.kilobyte
def self.attachment_definitions
{ hoge: nil }
end
end
end
let(:attribute_name) { "#{hoge}_remote_url".to_sym }
let(:code) { 200 }
let(:file) { 'filename="foo.txt"' }
let(:foo) { Foo.new }
let(:foo) { foo_class.new }
let(:headers) { { 'content-disposition' => file } }
let(:hoge) { :hoge }
let(:url) { 'https://google.com' }
before do
foo_class.include described_class
foo_class.remotable_attachment :hoge, 1.kilobyte
end
it 'defines a method #hoge_remote_url=' do
expect(foo).to respond_to(:hoge_remote_url=)
end