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.55.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.55.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.54.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.53.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.52.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.51.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.50.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.49.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.48.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.48.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.47.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.47.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.47.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.46.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.45.2 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.45.1 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.45.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.44.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.43.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb
eac_tools-0.42.0 sub/eac_ruby_utils/spec/lib/eac_ruby_utils/static_method_class_spec.rb