Sha256: 9250e7dfe071c1c159764229c490ef6cdfc931b3a258b16bcd27ebfe8df5ff45

Contents?: true

Size: 796 Bytes

Versions: 4

Compression:

Stored size: 796 Bytes

Contents

require 'spec_helper'

describe Metric do
  specify { subject.convert('1').should eq '1' }
  specify { subject.convert('1abc').should eq '1abc' }
  specify { subject.convert(1.2).should eq 1.2 }
  specify { subject.convert({}).should eq({}) }

  it 'returns last value' do
    value = stub(:value)
    subject.stub(:values => [stub, stub, stub(:last_value, :value => value)])
    subject.value.should == value
  end

  it 'returns last updater' do
    user = stub(:user)
    subject.stub(:values => [stub, stub, stub(:last_value, :created_by => user)])
    subject.last_updated_by.should == user
  end

  it 'returns last update date' do
    date = stub(:date)
    subject.stub(:values => [stub, stub, stub(:last_value, :created_at => date)])
    subject.last_updated_at.should == date
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
techcor-0.0.4 spec/lib/metrics/metric_spec.rb
techcor-0.0.3 spec/lib/metrics/metric_spec.rb
techcor-0.0.2 spec/lib/metrics/metric_spec.rb
techcor-0.0.1 spec/lib/metrics/metric_spec.rb