Sha256: 408a3c049713b6d12d9775b195a3b412868c81dff5c0fb484d243ff07511ecf4

Contents?: true

Size: 1.03 KB

Versions: 7

Compression:

Stored size: 1.03 KB

Contents

require 'spec_helper'

RSpec.describe "Span" do
  let(:span_model) { SpanModel.new(:start_date => Date.current, :end_date => nil) }
  let(:span) { span_model.span }

  context "#span_status" do
    before(:each) do
      allow(span).to receive(:current?).and_return(false)
      allow(span).to receive(:future?).and_return(false)
      allow(span).to receive(:expired?).and_return(false)
    end

    it "should return :unknown when all_conditions == false" do
      expect(span.span_status).to eq(:unknown)
    end

    it "should return :current when current? == true" do
      expect(span).to receive(:current?).once.and_return(true)

      expect(span.span_status).to eq(:current)
    end

    it "should return :current when future? == true" do
      expect(span).to receive(:future?).once.and_return(true)

      expect(span.span_status).to eq(:future)
    end

    it "should return :current when expired? == true" do
      expect(span).to receive(:expired?).once.and_return(true)

      expect(span.span_status).to eq(:expired)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
acts_as_span-1.2.2 spec/lib/span_instance/status_spec.rb
acts_as_span-1.2.1 spec/lib/span_instance/status_spec.rb
acts_as_span-1.2.0 spec/lib/span_instance/status_spec.rb
acts_as_span-1.1.1 spec/lib/span_instance/status_spec.rb
acts_as_span-1.1.0 spec/lib/span_instance/status_spec.rb
acts_as_span-1.0.0 spec/lib/span_instance/status_spec.rb
acts_as_span-0.0.6 spec/lib/span_instance/status_spec.rb