diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-14 14:51:12 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-14 14:51:12 +0300 |
commit | 3ade826065f38e3734090cf34fbfc28b68ba79d0 (patch) | |
tree | 8894c90dc892086df16782f2c54ca8f6b8b4adb6 /spec/models/environment_spec.rb | |
parent | e8f09f02bf8b0053f276a8e5ce0bdd18c621a1a3 (diff) |
Add specs for models and services
Diffstat (limited to 'spec/models/environment_spec.rb')
-rw-r--r-- | spec/models/environment_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/models/environment_spec.rb b/spec/models/environment_spec.rb new file mode 100644 index 00000000000..7629af6a570 --- /dev/null +++ b/spec/models/environment_spec.rb @@ -0,0 +1,14 @@ +require 'spec_helper' + +describe Environment, models: true do + let(:environment) { create(:environment) } + + it { is_expected.to belong_to(:project) } + it { is_expected.to have_many(:deployments) } + + it { is_expected.to delegate_method(:last_deployment).to(:deployments).as(:last) } + + it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_uniqueness_of(:name).scoped_to(:project_id) } + it { is_expected.to validate_length_of(:name).is_within(0..255) } +end |