Sha256: 4dccebba2e7e7a18686d9998b5ac9e663cc6b663baa04f18166ace57e44a2a18

Contents?: true

Size: 728 Bytes

Versions: 11

Compression:

Stored size: 728 Bytes

Contents

require 'spec_helper'

describe Microscope::Scope::BooleanScope do
  subject { User }

  before do
    run_migration do
      create_table(:users, force: true) do |t|
        t.boolean :active, default: false
      end
    end

    microscope 'User'
  end

  describe 'positive scope' do
    before do
      @user1 = User.create(active: true)
      @user2 = User.create(active: false)
    end

    its(:active) { should have(1).items }
    its(:active) { should include(@user1) }
  end

  describe 'negative scope' do
    before do
      @user1 = User.create(active: false)
      @user2 = User.create(active: true)
    end

    its(:not_active) { should have(1).items }
    its(:not_active) { should include(@user1) }
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
microscope-0.5.7 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.5.6.1 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.5.6 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.5.5 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.5.4 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.5.3 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.5.2 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.5.1 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.5 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.4.2 spec/microscope/scope/boolean_scope_spec.rb
microscope-0.4.1 spec/microscope/scope/boolean_scope_spec.rb