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

detail_spec.rb « namespace « models « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1bb756c441ba2a2fa2f1699fbf6920b8456edd28 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Namespace::Detail, type: :model do
  describe 'associations' do
    it { is_expected.to belong_to :namespace }
  end

  describe 'validations' do
    it { is_expected.to validate_presence_of(:namespace) }
  end

  context 'when namespace description changes' do
    let(:namespace) { create(:namespace, description: "old") }

    it 'changes namespace details description' do
      expect { namespace.update!(description: "new") }
        .to change { namespace.namespace_details.description }.from("old").to("new")
    end
  end

  context 'when project description changes' do
    let(:project) { create(:project, description: "old") }

    it 'changes project namespace details description' do
      expect { project.update!(description: "new") }
        .to change { project.project_namespace.namespace_details.description }.from("old").to("new")
    end
  end

  context 'when group description changes' do
    let(:group) { create(:group, description: "old") }

    it 'changes group namespace details description' do
      expect { group.update!(description: "new") }
        .to change { group.namespace_details.description }.from("old").to("new")
    end
  end
end