Welcome to mirror list, hosted at ThFree Co, Russian Federation.

feature_flag_spec.rb « data_builder « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 75511fcf9f50f636c629db385f1d0a005d8dd78d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::DataBuilder::FeatureFlag do
  let(:project) { create(:project) }
  let(:user) { create(:user) }
  let(:feature_flag) { create(:operations_feature_flag, project: project) }

  describe '.build' do
    let(:data) { described_class.build(feature_flag, user) }

    it { expect(data).to be_a(Hash) }
    it { expect(data[:object_kind]).to eq('feature_flag') }

    it 'contains the correct object attributes' do
      object_attributes = data[:object_attributes]

      expect(object_attributes[:id]).to eq(feature_flag.id)
      expect(object_attributes[:name]).to eq(feature_flag.name)
      expect(object_attributes[:description]).to eq(feature_flag.description)
      expect(object_attributes[:active]).to eq(feature_flag.active)
    end
  end
end