Sha256: 702a5ec3b99affab12ad8870be2698abad61643ebd924d2c66b5f11cbf7fec89

Contents?: true

Size: 660 Bytes

Versions: 11

Compression:

Stored size: 660 Bytes

Contents

require_relative '../../spec_helper'

describe IsolatedServer::Mongodb do
  subject { IsolatedServer::Mongodb.new }
  let(:collection) { subject.connection['test_db']['test_col'] }
  describe "#boot!" do
    it "starts up a new server" do
      subject.boot!
      expect(subject.pid).to be_a_running_process

      id = nil
      expect { id = collection.insert(name: 'Bob') }.
        to change { collection.count }.
        from(0).
        to(1)

      result = collection.find_one(id)
      expect(result['name']).to eq('Bob')

      subject.down!
      expect(subject.pid).not_to be_a_running_process
      expect(subject).not_to be_up
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
isolated_server-0.4.12 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.11 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.10 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.9 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.8 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.7 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.6 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.5 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.4 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.3 spec/lib/isolated_server/mongodb_spec.rb
isolated_server-0.4.2 spec/lib/isolated_server/mongodb_spec.rb