Sha256: 275aa175a439e64ec4cd0f6c595bc6444fbeff41dde4219ecd26508c0f3349b6

Contents?: true

Size: 957 Bytes

Versions: 74

Compression:

Stored size: 957 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/static_method_class'

::RSpec.describe ::EacRubyUtils::StaticMethodClass do
  let(:sender_class) do
    ::Class.new do
      class << self
        def sender_value
          'AAA'
        end
      end
    end
  end

  let(:method_class) do
    the_described_class = described_class
    ::Class.new do
      def self.name
        'TheSender::PerformX'
      end

      include the_described_class
      attr_accessor :sender, :method_param

      def initialize(sender, method_param)
        self.sender = sender
        self.method_param = method_param
      end

      def result
        "#{sender.sender_value},#{method_param}"
      end
    end
  end

  before do
    ::Object.const_set('TheSender', sender_class)
    sender_class.const_set('PerformX', method_class)
  end

  it { expect(sender_class).to respond_to(:perform_x) }
  it { expect(sender_class.perform_x('BBB')).to eq('AAA,BBB') }
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
eac_tools-0.76.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.76.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.75.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.75.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.75.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.74.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.74.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.73.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.72.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.70.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.70.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.69.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.69.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.68.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.67.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.67.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.66.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.65.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.65.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.64.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb