diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-03 06:11:21 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-26 22:48:30 +0300 |
commit | c0faf91ff23815404a95cf4510b43dcf5e331c4f (patch) | |
tree | 81769f125569dd6ea012920544ada1e8666ba4e5 /spec/models/project_spec.rb | |
parent | b06dc74d611192744d34acda944d7ed9e554342a (diff) |
Add `to_reference` for models that support references
Now there is a single source of information for which attribute a model
uses to be referenced, and its special character.
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r-- | spec/models/project_spec.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 37e21a90818..48568e2a3ff 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -32,7 +32,7 @@ require 'spec_helper' describe Project do - describe 'Associations' do + describe 'associations' do it { is_expected.to belong_to(:group) } it { is_expected.to belong_to(:namespace) } it { is_expected.to belong_to(:creator).class_name('User') } @@ -54,10 +54,17 @@ describe Project do it { is_expected.to have_one(:asana_service).dependent(:destroy) } end - describe 'Mass assignment' do + describe 'modules' do + subject { described_class } + + it { is_expected.to include_module(Gitlab::ConfigHelper) } + it { is_expected.to include_module(Gitlab::ShellAdapter) } + it { is_expected.to include_module(Gitlab::VisibilityLevel) } + it { is_expected.to include_module(Referable) } + it { is_expected.to include_module(Sortable) } end - describe 'Validation' do + describe 'validation' do let!(:project) { create(:project) } it { is_expected.to validate_presence_of(:name) } @@ -91,6 +98,14 @@ describe Project do it { is_expected.to respond_to(:path_with_namespace) } end + describe '#to_reference' do + let(:project) { create(:empty_project) } + + it 'returns a String reference to the object' do + expect(project.to_reference).to eq project.path_with_namespace + end + end + it 'should return valid url to repo' do project = Project.new(path: 'somewhere') expect(project.url_to_repo).to eq(Gitlab.config.gitlab_shell.ssh_path_prefix + 'somewhere.git') |