blob: d359c443ea0919dd12776c89eb884cfb43174958 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
require 'spec_helper'
describe Chouette::Loader, :type => :model do
subject { Chouette::Loader.new("test") }
before(:each) do
allow(subject).to receive_messages :execute! => true
end
describe "#load_dump" do
end
describe "#import" do
let(:chouette_command) { double :run! => true }
before(:each) do
allow(subject).to receive_messages :chouette_command => chouette_command
end
it "should use specified file in -inputFile option" do
expect(chouette_command).to receive(:run!).with(hash_including(:input_file => File.expand_path('file')))
subject.import "file"
end
it "should use specified format in -format option" do
expect(chouette_command).to receive(:run!).with(hash_including(:format => 'DUMMY'))
subject.import "file", :format => "dummy"
end
end
describe "#create" do
it "should quote schema name" do
expect(subject).to receive(:execute!).with(/"test"/)
subject.create
end
end
describe "#drop" do
it "should quote schema name" do
expect(subject).to receive(:execute!).with(/"test"/)
subject.drop
end
end
describe "#backup" do
let(:file) { "/dev/null" }
it "should call pg_dump" do
expect(subject).to receive(:execute!).with(/^pg_dump/)
subject.backup file
end
it "should dump in specified file" do
expect(subject).to receive(:execute!).with(/-f #{file}/)
subject.backup file
end
end
end
|