File: base_spec.rb

package info (click to toggle)
ruby-database-cleaner 1.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 768 kB
  • sloc: ruby: 4,854; makefile: 10; sh: 4
file content (43 lines) | stat: -rw-r--r-- 1,336 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'spec_helper'
require 'database_cleaner/neo4j/base'
require 'database_cleaner/shared_strategy'

module DatabaseCleaner
  describe Neo4j do
    it { should respond_to(:available_strategies) }
  end

  module Neo4j
    class ExampleStrategy
      include ::DatabaseCleaner::Neo4j::Base
    end

    describe ExampleStrategy do

      it_should_behave_like "a generic strategy"
      it { should respond_to(:db) }
      it { should respond_to(:db=) }

      it "should store my describe db" do
        db_conf = {:connection => {:type => :server_db, :path => 'http://localhost:7474'}}
        subject.db = db_conf
        subject.db.should eq db_conf
      end

      it "should respect additional connection parameters" do
        db_conf = {:type => :server_db, :path => 'http://localhost:7474', basic_auth: {username: 'user', password: 'pass'}}
        subject.db = db_conf
        stub_const("Neo4j::Session", double()).should_receive(:open).with(:server_db, 'http://localhost:7474', {basic_auth: {username: 'user', password: 'pass'}}) { true }
        subject.start
      end

      it "should default to nil" do
        subject.db.should be_nil
      end

      it "should return default configuration" do
        subject.database.should eq(:type => :server_db, :path => 'http://localhost:7475/')
      end
    end
  end
end