agraph 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,113 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
2
- require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "allegro_graph", "federation"))
3
-
4
- describe AllegroGraph::Federation do
5
-
6
- before :each do
7
- @server = AllegroGraph::Server.new :username => "test", :password => "test"
8
- @federation = AllegroGraph::Federation.new @server,
9
- "test_federation",
10
- :repository_names => [ "test_repository" ],
11
- :repository_urls => [ "http://username:password@server:10035/repositories/another" ]
12
- end
13
-
14
- describe "==" do
15
-
16
- it "should be true when comparing two equal federations" do
17
- other = AllegroGraph::Federation.new @server, "test_federation"
18
- @federation.should == other
19
- end
20
-
21
- it "should be false when comparing two different federations" do
22
- other = AllegroGraph::Federation.new @server, "other_federationy"
23
- @federation.should_not == other
24
- end
25
-
26
- end
27
-
28
- describe "request" do
29
-
30
- before :each do
31
- @server.stub!(:request)
32
- end
33
-
34
- it "should call the server's request method" do
35
- @server.should_receive(:request).with(:get, "/", { })
36
- @federation.request :get, "/"
37
- end
38
-
39
- end
40
-
41
- describe "exists?" do
42
-
43
- context "for a federation that already exists" do
44
-
45
- it "should return true" do
46
- @federation.exists?.should be_true
47
- end
48
-
49
- end
50
-
51
- context "for a federation that not exists" do
52
-
53
- before :each do
54
- @federation.name = "not_existing"
55
- end
56
-
57
- it "should return false" do
58
- @federation.exists?.should be_false
59
- end
60
-
61
- end
62
-
63
- end
64
-
65
- describe "create!" do
66
-
67
- it "should return true" do
68
- @federation.create!.should be_true
69
- end
70
-
71
- end
72
-
73
- describe "create_if_missing!" do
74
-
75
- it "should do nothing if the federation already exists" do
76
- @federation.stub!(:exists?).and_return(true)
77
- @federation.should_not_receive(:create!)
78
- @federation.create_if_missing!
79
- end
80
-
81
- it "should call create! if the federation doesn't exists" do
82
- @federation.stub!(:exists?).and_return(false)
83
- @federation.should_receive(:create!)
84
- @federation.create_if_missing!
85
- end
86
-
87
- end
88
-
89
- describe "delete!" do
90
-
91
- it "should return true" do
92
- @federation.delete!.should be_true
93
- end
94
-
95
- end
96
-
97
- describe "delete_if_exists!" do
98
-
99
- it "should call delete! if the federation already exists" do
100
- @federation.stub!(:exists?).and_return(true)
101
- @federation.should_receive(:delete!)
102
- @federation.delete_if_exists!
103
- end
104
-
105
- it "should do nothing if the federation doesn't exists" do
106
- @federation.stub!(:exists?).and_return(false)
107
- @federation.should_not_receive(:delete!)
108
- @federation.delete_if_exists!
109
- end
110
-
111
- end
112
-
113
- end