2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
RSpec.describe Gitlab::GithubImport::Representation::ExposeAttribute do
|
2018-03-17 18:26:18 +05:30
|
|
|
it 'defines a getter method that returns an attribute value' do
|
|
|
|
klass = Class.new do
|
|
|
|
include Gitlab::GithubImport::Representation::ExposeAttribute
|
|
|
|
|
|
|
|
expose_attribute :number
|
|
|
|
|
|
|
|
attr_reader :attributes
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
@attributes = { number: 42 }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(klass.new.number).to eq(42)
|
|
|
|
end
|
|
|
|
end
|