Sha256: 6ec47a8f8585443ebc2d2556f3d04fa44d56d82ede097ce9c83bd24a0f7efd8a

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

describe MassInsert::Result do
  let!(:values) { [{name: "name"}] }
  let!(:options){ {option: "value"} }
  let!(:process){ MassInsert::Process.new(values, options) }
  let!(:subject){ MassInsert::Result.new(process) }

  before :each do
    benchmark = Benchmark.measure{}
    benchmark.stub(:total).and_return(10)
    process.instance_variable_set(:@building_time, benchmark)
    process.instance_variable_set(:@execution_time, benchmark)
  end

  describe "initialize" do
    it "sets instance process variable" do
      expect(subject.instance_variable_get(:@process)).to eq(process)
    end
  end

  describe "#building_time" do
    it "returns instance building_time variable in process instance" do
      expect(subject.building_time).to be(10)
    end
  end

  describe "#execution_time" do
    it "returns instance execution_time variable in process instance" do
      expect(subject.execution_time).to be(10)
    end
  end

  describe "#time" do
    it "sums building_time and execution_time" do
      expect(subject.time).to be(20)
    end
  end

  describe "#records" do
    it "returns size of instance values variable in process instance" do
      expect(subject.records).to be(1)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mass_insert-0.1.3 spec/lib/mass_insert/result_spec.rb
mass_insert-0.1.2 spec/lib/mass_insert/result_spec.rb