Sha256: ac25bd90c5e082285f7fee2434612b9512f66225b938c0ee59674d72faa52bab

Contents?: true

Size: 962 Bytes

Versions: 3

Compression:

Stored size: 962 Bytes

Contents

require 'spec_helper'

describe Microscope::InstanceMethod::DateInstanceMethod do
  before do
    run_migration do
      create_table(:events, force: true) do |t|
        t.date :started_on, default: nil
      end
    end

    microscope 'Event'
  end

  describe '#started?' do
    context 'with positive result' do
      subject { Event.create(started_on: 2.months.ago) }
      it { should be_started }
      it { should_not be_not_started }
    end

    context 'with negative result' do
      subject { Event.create(started_on: 1.month.from_now) }
      it { should_not be_started }
      it { should be_not_started }
    end
  end

  describe '#not_started?' do
    context 'with negative result' do
      subject { Event.create(started_on: 2.months.ago) }
      it { should_not be_not_started }
    end

    context 'with positive result' do
      subject { Event.create(started_on: 1.month.from_now) }
      it { should be_not_started }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
microscope-0.5 spec/microscope/instance_method/date_instance_method_spec.rb
microscope-0.4.2 spec/microscope/instance_method/date_instance_method_spec.rb
microscope-0.4.1 spec/microscope/instance_method/date_instance_method_spec.rb