Sha256: da9ffc8db63d3fda4f3324e9789022625ea17de973e425418b3303d03a45f18d

Contents?: true

Size: 1011 Bytes

Versions: 1

Compression:

Stored size: 1011 Bytes

Contents

require 'pgit'

describe 'PGit::Validators::ProjectValidator' do
  describe '#valid?' do
    it 'should not be valid when the request for stories fails' do
      class SomeFakeProjectWithKindError
        include ActiveModel::Validations
        validates_with PGit::Validators::ProjectValidator
        def get!
        end

        def kind
          'error'
        end
      end
      project = SomeFakeProjectWithKindError.new
      validator = PGit::Validators::ProjectValidator.new
      validator.validate(project)

      expect(project).not_to be_valid
    end

    it 'should not be valid if the project does not have a kind' do
      class SomeFakeProjectWithNoKind
        include ActiveModel::Validations
        validates_with PGit::Validators::ProjectValidator

        def get!
        end
      end

      project = SomeFakeProjectWithNoKind.new
      validator = PGit::Validators::ProjectValidator.new
      validator.validate(project)

      expect(project).not_to be_valid
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pgit-1.0.0 spec/pgit/validators/project_validator_spec.rb