Sha256: 7eeadc938eb07616e405c6d06ad9440f9e57600f39979955ebc0424246dfb2fc

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

require 'spec_helper'

describe KalibroClient::Entities::Miscellaneous::NativeMetric, :type => :model do
  describe 'methods' do
    describe 'initialize' do
      context 'with valid attributes' do
        let(:name){ "Sample name" }
        let(:code){ "sample_code" }
        let(:scope){ KalibroClient::Entities::Miscellaneous::Granularity.new(:SOFTWARE) }
        let(:languages){ [:C, :CPP, :JAVA] }
        let(:metric_collector_name){ "Analizo" }
        let(:native_metric){ KalibroClient::Entities::Miscellaneous::NativeMetric.new(name, code, scope, languages, metric_collector_name) }

        it 'is expected to return an instance of NativeMetric' do
          expect(native_metric).to be_a(KalibroClient::Entities::Miscellaneous::NativeMetric)
        end
      end
    end

    describe 'to_object' do
      subject{ FactoryGirl.build(:loc) }

      context 'with a hash' do
        it 'is expected to create a object from the hash' do
          subject_hash = subject.to_hash
          expect(KalibroClient::Entities::Miscellaneous::NativeMetric.to_object(subject_hash)).to eq(subject)
        end
      end

      context 'with a metric' do
        it 'is expected to be the same object as the argument' do
          expect(KalibroClient::Entities::Miscellaneous::NativeMetric.to_object(subject)).to eq(subject)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kalibro_client-5.0.0 spec/entities/miscellaneous/native_metric_spec.rb
kalibro_client-4.0.0 spec/entities/miscellaneous/native_metric_spec.rb
kalibro_client-4.0.0.alpha1 spec/entities/miscellaneous/native_metric_spec.rb
kalibro_client-3.0.1 spec/entities/miscellaneous/native_metric_spec.rb
kalibro_client-3.0.0 spec/entities/miscellaneous/native_metric_spec.rb