jubjub 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. data/README.mdown +27 -1
  2. data/lib/jubjub.rb +1 -1
  3. data/lib/jubjub/connection/xmpp_gateway.rb +9 -9
  4. data/lib/jubjub/connection/xmpp_gateway/helper.rb +5 -5
  5. data/lib/jubjub/connection/xmpp_gateway/muc.rb +127 -32
  6. data/lib/jubjub/connection/xmpp_gateway/pubsub.rb +64 -64
  7. data/lib/jubjub/data_form.rb +16 -13
  8. data/lib/jubjub/errors.rb +2 -2
  9. data/lib/jubjub/helpers.rb +32 -0
  10. data/lib/jubjub/jid.rb +8 -8
  11. data/lib/jubjub/muc.rb +3 -1
  12. data/lib/jubjub/muc/affiliation.rb +77 -0
  13. data/lib/jubjub/muc/affiliations_collection.rb +31 -0
  14. data/lib/jubjub/muc/collection.rb +12 -19
  15. data/lib/jubjub/muc/configuration.rb +2 -2
  16. data/lib/jubjub/muc/muc.rb +24 -11
  17. data/lib/jubjub/pubsub.rb +1 -1
  18. data/lib/jubjub/pubsub/affiliation.rb +20 -20
  19. data/lib/jubjub/pubsub/affiliation_collection.rb +11 -18
  20. data/lib/jubjub/pubsub/collection.rb +14 -21
  21. data/lib/jubjub/pubsub/configuration.rb +2 -2
  22. data/lib/jubjub/pubsub/item.rb +8 -8
  23. data/lib/jubjub/pubsub/item_collection.rb +10 -17
  24. data/lib/jubjub/pubsub/pubsub.rb +17 -17
  25. data/lib/jubjub/pubsub/subscription.rb +6 -6
  26. data/lib/jubjub/response.rb +1 -1
  27. data/lib/jubjub/response/error.rb +6 -6
  28. data/lib/jubjub/response/proxy.rb +8 -8
  29. data/lib/jubjub/response/response.rb +10 -10
  30. data/lib/jubjub/user.rb +16 -15
  31. data/spec/connection/xmpp_gateway_muc_spec.rb +174 -40
  32. data/spec/connection/xmpp_gateway_pubsub_spec.rb +100 -104
  33. data/spec/fixtures/vcr_cassettes/muc_configuration.yml +73 -6
  34. data/spec/fixtures/vcr_cassettes/muc_create_with_configuration.yml +8 -8
  35. data/spec/fixtures/vcr_cassettes/muc_message.yml +89 -0
  36. data/spec/fixtures/vcr_cassettes/muc_modify_affiliations.yml +367 -0
  37. data/spec/fixtures/vcr_cassettes/muc_retrieve_affiliations.yml +93 -0
  38. data/spec/fixtures/vcr_cassettes/pubsub_publish_with_dataform_payload.yml +3 -3
  39. data/spec/fixtures/vcr_cassettes/pubsub_retrieve_items.yml +24 -18
  40. data/spec/mixins/user_spec.rb +37 -37
  41. data/spec/models/data_form_spec.rb +3 -3
  42. data/spec/models/jid_spec.rb +41 -41
  43. data/spec/models/muc_affiliation_collection_spec.rb +146 -0
  44. data/spec/models/muc_affiliation_spec.rb +215 -0
  45. data/spec/models/muc_collection_spec.rb +64 -32
  46. data/spec/models/muc_configuration_spec.rb +3 -3
  47. data/spec/models/muc_spec.rb +44 -23
  48. data/spec/models/pubsub_affiliation_collection_spec.rb +65 -30
  49. data/spec/models/pubsub_affiliation_spec.rb +50 -50
  50. data/spec/models/pubsub_collection_spec.rb +65 -49
  51. data/spec/models/pubsub_item_collection_spec.rb +17 -17
  52. data/spec/models/pubsub_item_spec.rb +18 -18
  53. data/spec/models/pubsub_spec.rb +41 -41
  54. data/spec/models/pubsub_subscription_spec.rb +23 -23
  55. data/spec/models/response_error_spec.rb +19 -19
  56. data/spec/models/response_proxy_spec.rb +51 -49
  57. data/spec/models/response_spec.rb +33 -33
  58. data/spec/support/helpers.rb +21 -1
  59. data/spec/support/matchers.rb +4 -4
  60. data/spec/support/shared_examples.rb +132 -94
  61. data/spec/support/webmock_stanza_matching.rb +43 -0
  62. metadata +45 -16
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jubjub::Muc::Configuration do
4
-
4
+
5
5
  it_behaves_like "any data form"
6
-
7
- end
6
+
7
+ end
@@ -1,85 +1,106 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jubjub::Muc do
4
-
4
+
5
5
  describe "instance method" do
6
-
6
+
7
7
  describe "inspect" do
8
-
8
+
9
9
  it "should not show connection information" do
10
10
  m = Jubjub::Muc.new(Jubjub::Jid.new("hello@conference.foo.com"),nil,"SHHHH CONNECTION OBJECT")
11
11
  m.inspect.should_not match 'SHHHH CONNECTION OBJECT'
12
12
  end
13
-
13
+
14
14
  it "should show string version of jid" do
15
15
  m = Jubjub::Muc.new(Jubjub::Jid.new("hello@conference.foo.com"),nil,mock)
16
16
  m.inspect.should match 'hello@conference.foo.com'
17
17
  end
18
-
18
+
19
19
  it "should show name" do
20
20
  m = Jubjub::Muc.new(Jubjub::Jid.new("hello@conference.foo.com"),nil,mock)
21
21
  m.inspect.should match '@name=nil'
22
-
22
+
23
23
  m = Jubjub::Muc.new(Jubjub::Jid.new("hello@conference.foo.com"),"Hey there",mock)
24
24
  m.inspect.should match '@name="Hey there"'
25
25
  end
26
-
26
+
27
27
  end
28
-
28
+
29
29
  describe "jid" do
30
30
  it "should return the jid object" do
31
31
  Jubjub::Muc.new("hello@conference.foo.com",nil,mock).jid.should == Jubjub::Jid.new("hello@conference.foo.com")
32
32
  end
33
33
  end
34
-
34
+
35
35
  describe "name" do
36
36
  it "should return the name" do
37
37
  Jubjub::Muc.new("hello@conference.foo.com",nil,mock).name.should be_nil
38
38
  Jubjub::Muc.new("hello@conference.foo.com","bar",mock).name.should eql("bar")
39
39
  end
40
40
  end
41
-
41
+
42
+ describe "message" do
43
+
44
+ before do
45
+ @mock_connection = mock
46
+ @mock_connection.stub_chain :muc, :message
47
+ end
48
+
49
+ it "should call muc.message on connection" do
50
+ jid = Jubjub::Jid.new "room@conference.foo.com"
51
+ @mock_connection.muc.should_receive( :message ).with( jid, "rrrrspec" )
52
+
53
+ Jubjub::Muc.new( jid, nil, @mock_connection ).message( "rrrrspec" )
54
+ end
55
+
56
+ it "should be chainable" do
57
+ room = Jubjub::Muc.new("room@conference.foo.com", nil, @mock_connection)
58
+ room.message("whoop").should eql room
59
+ end
60
+
61
+ end
62
+
42
63
  describe "exit" do
43
64
  before do
44
65
  muc_mock = mock
45
66
  muc_mock.stub(:exit) # exit doesn't work in a stub chain, manually build it
46
-
67
+
47
68
  @mock_connection = mock
48
69
  @mock_connection.stub(:jid).and_return( Jubjub::Jid.new 'nick@foo.com' )
49
70
  @mock_connection.stub(:muc).and_return( muc_mock )
50
71
  end
51
-
72
+
52
73
  it "should call muc.exit on connection" do
53
74
  @mock_connection.muc.should_receive(:exit).with( Jubjub::Jid.new 'room@conference.foo.com/nick' )
54
-
75
+
55
76
  Jubjub::Muc.new("room@conference.foo.com",nil,@mock_connection).exit
56
77
  end
57
-
78
+
58
79
  it "should support custom nick name" do
59
80
  @mock_connection.muc.should_receive(:exit).with( Jubjub::Jid.new 'room@conference.foo.com/custom_nick' )
60
-
81
+
61
82
  Jubjub::Muc.new("room@conference.foo.com",nil,@mock_connection).exit('custom_nick')
62
83
  end
63
-
84
+
64
85
  it "should be chainable" do
65
86
  room = Jubjub::Muc.new("room@conference.foo.com",nil,@mock_connection)
66
87
  room.exit.should eql room
67
88
  end
68
89
  end
69
-
90
+
70
91
  describe "destroy" do
71
-
92
+
72
93
  it "should call muc.destroy on connection" do
73
94
  mock_connection = mock
74
95
  mock_connection.stub_chain :muc, :destroy
75
96
  mock_connection.muc.should_receive(:destroy).with( Jubjub::Jid.new 'hello@conference.foo.com' )
76
-
97
+
77
98
  m = Jubjub::Muc.new('hello@conference.foo.com',nil,mock_connection)
78
99
  m.destroy
79
100
  end
80
-
101
+
81
102
  end
82
-
103
+
83
104
  end
84
-
85
- end
105
+
106
+ end
@@ -1,18 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jubjub::Pubsub::AffiliationCollection do
4
-
4
+
5
5
  describe "that are proxied like" do
6
-
6
+
7
7
  before do
8
8
  @mock_connection = mock
9
9
  @affiliations = [
10
10
  Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node', 'theozaurus@foo.com', 'owner', @mock_connection),
11
- Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node', 'dragonzaurus@foo.com', 'publisher', @mock_connection)
11
+ Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node', 'dragonzaurus@foo.com', 'publisher', @mock_connection)
12
12
  ]
13
13
  @mock_connection.stub_chain( :pubsub, :retrieve_affiliations ).and_return(@affiliations)
14
14
  end
15
-
15
+
16
16
  describe "inspect" do
17
17
 
18
18
  it "should show the list of affiliations, not Pubsub::AffiliationCollection" do
@@ -29,58 +29,93 @@ describe Jubjub::Pubsub::AffiliationCollection do
29
29
  end
30
30
 
31
31
  end
32
-
32
+
33
33
  end
34
-
34
+
35
35
  describe "instance method" do
36
-
36
+
37
37
  describe "jid" do
38
38
  it "should return the jid" do
39
39
  Jubjub::Pubsub::AffiliationCollection.new("pubsub.foo.com", "node", mock).jid.should == Jubjub::Jid.new("pubsub.foo.com")
40
40
  end
41
41
  end
42
-
42
+
43
43
  describe "node" do
44
44
  it "should return the node" do
45
45
  Jubjub::Pubsub::AffiliationCollection.new("pubsub.foo.com", "node", mock).node.should == 'node'
46
46
  end
47
47
  end
48
-
48
+
49
49
  describe "[]" do
50
50
  before do
51
51
  @mock_connection = mock
52
52
  @nodes = [
53
53
  Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node_1', 'theozaurus@foo.com', 'owner', @mock_connection),
54
- Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node_1', 'dragonzaurus@foo.com', 'member', @mock_connection)
54
+ Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node_1', 'dragonzaurus@foo.com', 'member', @mock_connection)
55
55
  ]
56
56
  @mock_connection.stub_chain( :pubsub, :retrieve_affiliations ).and_return(@nodes)
57
57
  end
58
-
58
+
59
59
  subject { Jubjub::Pubsub::AffiliationCollection.new "pubsub.foo.com", "node_1", @mock_connection }
60
-
60
+
61
61
  it "should work like a normal array when passed a Fixnum" do
62
62
  subject[1].should == @nodes[1]
63
63
  end
64
-
65
- it "should search by jid if a String" do
66
- subject["theozaurus@foo.com"].should == @nodes[0]
67
- end
68
64
 
69
- it "should return affiliation of 'none' if not found when searching by String" do
70
- subject['blogozaurus@foo.com'].should ==
71
- Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node_1', 'blogozaurus@foo.com', 'none', @mock_connection)
72
- end
73
-
74
- it "should search by Jid if Jubjub::Jid" do
75
- subject[Jubjub::Jid.new 'dragonzaurus@foo.com'].should == @nodes[1]
65
+ describe "searching by node if a String" do
66
+
67
+ it "should return cached result if it has already searched" do
68
+ # Trigger lookup
69
+ @mock_connection.pubsub.should_receive(:retrieve_affiliations)
70
+ subject.first
71
+ subject["theozaurus@foo.com"].should equal @nodes[0]
72
+ end
73
+
74
+ it "should return default result if it has already searched and does not exist" do
75
+ # Trigger lookup
76
+ @mock_connection.pubsub.should_receive(:retrieve_affiliations)
77
+ subject.first
78
+ subject['blogozaurus@foo.com'].should ==
79
+ Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node_1', 'blogozaurus@foo.com', 'none', @mock_connection)
80
+ end
81
+
82
+ it "should return default result if it has not already searched" do
83
+ @mock_connection.pubsub.should_not_receive(:retrieve_affiliations)
84
+ subject['theozaurus@foo.com'].should_not equal @nodes[0]
85
+ subject['theozaurus@foo.com'].should ==
86
+ Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node_1', 'theozaurus@foo.com', 'none', @mock_connection)
87
+ end
88
+
76
89
  end
77
-
78
- it "should return afiliation of 'none' if not found when searching by Jubjub::Jid" do
79
- subject[Jubjub::Jid.new 'blogozaurus@foo.com'].should ==
80
- Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node_1', 'blogozaurus@foo.com', 'none', @mock_connection)
90
+
91
+ describe "searching by jid if a Jubjub::Jid" do
92
+
93
+ it "should return cached result if it has already searched" do
94
+ # Trigger lookup
95
+ @mock_connection.pubsub.should_receive(:retrieve_affiliations)
96
+ subject.first
97
+ subject[Jubjub::Jid.new "theozaurus@foo.com"].should equal @nodes[0]
98
+ end
99
+
100
+ it "should return default result if it has already searched and does not exist" do
101
+ # Trigger lookup
102
+ @mock_connection.pubsub.should_receive(:retrieve_affiliations)
103
+ subject.first
104
+ subject[Jubjub::Jid.new 'blogozaurus@foo.com'].should ==
105
+ Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node_1', 'blogozaurus@foo.com', 'none', @mock_connection)
106
+ end
107
+
108
+ it "should return default result if it has not already searched" do
109
+ @mock_connection.pubsub.should_not_receive(:retrieve_affiliations)
110
+ subject[Jubjub::Jid.new 'theozaurus@foo.com'].should_not equal @nodes[0]
111
+ subject[Jubjub::Jid.new 'theozaurus@foo.com'].should ==
112
+ Jubjub::Pubsub::Affiliation.new('pubsub.foo.com', 'node_1', 'theozaurus@foo.com', 'none', @mock_connection)
113
+ end
114
+
81
115
  end
116
+
82
117
  end
83
-
118
+
84
119
  end
85
-
86
- end
120
+
121
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jubjub::Pubsub::Affiliation do
4
-
4
+
5
5
  def pubsub_affiliation_factory(override = {})
6
6
  options = {
7
7
  :pubsub_jid => Jubjub::Jid.new("pubsub.foo.com"),
@@ -10,7 +10,7 @@ describe Jubjub::Pubsub::Affiliation do
10
10
  :affiliation => 'owner',
11
11
  :connection => "SHHHH CONNECTION OBJECT"
12
12
  }.merge( override )
13
-
13
+
14
14
  Jubjub::Pubsub::Affiliation.new(
15
15
  options[:pubsub_jid],
16
16
  options[:pubsub_node],
@@ -19,106 +19,106 @@ describe Jubjub::Pubsub::Affiliation do
19
19
  options[:connection]
20
20
  )
21
21
  end
22
-
22
+
23
23
  describe "instance method" do
24
-
24
+
25
25
  describe "pubsub_jid" do
26
26
  it "should return the pubsub_jid" do
27
27
  p = pubsub_affiliation_factory :pubsub_jid => 'pubsub.foo.com'
28
28
  p.pubsub_jid.should == Jubjub::Jid.new('pubsub.foo.com')
29
29
  end
30
30
  end
31
-
31
+
32
32
  describe "pubsub_node" do
33
33
  it "should return the node" do
34
34
  p = pubsub_affiliation_factory :pubsub_node => 'node_1'
35
35
  p.pubsub_node.should == 'node_1'
36
36
  end
37
37
  end
38
-
38
+
39
39
  describe "jid" do
40
40
  it "should return the jid" do
41
41
  p = pubsub_affiliation_factory :jid => 'bob@foo.com'
42
42
  p.jid.should == Jubjub::Jid.new('bob@foo.com')
43
43
  end
44
44
  end
45
-
45
+
46
46
  describe "affiliation" do
47
47
  it "should return the affiliation" do
48
48
  p = pubsub_affiliation_factory :affiliation => 'publisher'
49
49
  p.affiliation.should == 'publisher'
50
50
  end
51
51
  end
52
-
52
+
53
53
  describe "owner?" do
54
54
  it "should return true when affiliation is 'owner'" do
55
55
  pubsub_affiliation_factory( :affiliation => 'owner' ).owner?.should equal(true)
56
56
  end
57
-
57
+
58
58
  it "should return false when affiliation is not 'owner'" do
59
59
  pubsub_affiliation_factory( :affiliation => 'publisher' ).owner?.should equal(false)
60
60
  end
61
61
  end
62
-
62
+
63
63
  describe "publisher?" do
64
64
  it "should return true when affiliation is 'publisher'" do
65
65
  pubsub_affiliation_factory( :affiliation => 'publisher' ).publisher?.should equal(true)
66
66
  end
67
-
67
+
68
68
  it "should return false when affiliation is not 'publisher'" do
69
69
  pubsub_affiliation_factory( :affiliation => 'owner' ).publisher?.should equal(false)
70
70
  end
71
71
  end
72
-
72
+
73
73
  describe "publish_only?" do
74
74
  it "should return true when affiliation is 'publish-only'" do
75
75
  pubsub_affiliation_factory( :affiliation => 'publish-only' ).publish_only?.should equal(true)
76
76
  end
77
-
77
+
78
78
  it "should return false when affiliation is not 'publish-only'" do
79
79
  pubsub_affiliation_factory( :affiliation => 'publisher' ).publish_only?.should equal(false)
80
80
  end
81
81
  end
82
-
82
+
83
83
  describe "member?" do
84
84
  it "should return true when affiliation is 'member'" do
85
85
  pubsub_affiliation_factory( :affiliation => 'member' ).member?.should equal(true)
86
86
  end
87
-
87
+
88
88
  it "should return false when affiliation is not 'member'" do
89
89
  pubsub_affiliation_factory( :affiliation => 'publisher' ).member?.should equal(false)
90
90
  end
91
91
  end
92
-
92
+
93
93
  describe "none?" do
94
94
  it "should return true when affiliation is 'none'" do
95
95
  pubsub_affiliation_factory( :affiliation => 'none' ).none?.should equal(true)
96
96
  end
97
-
97
+
98
98
  it "should return false when affiliation is not 'none'" do
99
99
  pubsub_affiliation_factory( :affiliation => 'publisher' ).none?.should equal(false)
100
100
  end
101
101
  end
102
-
102
+
103
103
  describe "outcast?" do
104
104
  it "should return true when affiliation is 'outcast'" do
105
105
  pubsub_affiliation_factory( :affiliation => 'outcast' ).outcast?.should equal(true)
106
106
  end
107
-
107
+
108
108
  it "should return false when affiliation is not 'outcast'" do
109
109
  pubsub_affiliation_factory( :affiliation => 'publisher' ).outcast?.should equal(false)
110
110
  end
111
111
  end
112
-
112
+
113
113
  describe "set" do
114
114
  it "should redirect call to pubsub.modify_affiliation" do
115
115
  @mock_connection = mock
116
116
  @mock_connection.stub_chain :pubsub, :modify_affiliations
117
-
117
+
118
118
  affiliation = pubsub_affiliation_factory :connection => @mock_connection
119
-
119
+
120
120
  @mock_connection.pubsub.should_receive(:modify_affiliations).with( affiliation.pubsub_jid, affiliation.pubsub_node, affiliation )
121
-
121
+
122
122
  affiliation.set 'publisher'
123
123
  end
124
124
 
@@ -127,30 +127,30 @@ describe Jubjub::Pubsub::Affiliation do
127
127
  @mock_connection = mock
128
128
  @mock_connection.stub_chain( :pubsub, :modify_affiliations ).and_return( true )
129
129
  end
130
-
130
+
131
131
  it "should return true" do
132
132
  @affiliation = pubsub_affiliation_factory :connection => @mock_connection
133
133
  @affiliation.set( 'publisher' ).should equal( true )
134
134
  end
135
-
135
+
136
136
  it "should have affiliaton set to new value" do
137
137
  @affiliation = pubsub_affiliation_factory :connection => @mock_connection, :affiliation => 'owner'
138
138
  @affiliation.set 'publisher'
139
139
  @affiliation.affiliation.should == 'publisher'
140
140
  end
141
141
  end
142
-
142
+
143
143
  describe "when unsuccesful" do
144
144
  before do
145
145
  @mock_connection = mock
146
146
  @mock_connection.stub_chain( :pubsub, :modify_affiliations ).and_return( false )
147
147
  end
148
-
148
+
149
149
  it "should return false" do
150
150
  @affiliation = pubsub_affiliation_factory :connection => @mock_connection
151
151
  @affiliation.set( 'publisher' ).should equal( false )
152
152
  end
153
-
153
+
154
154
  it "should have affiliaton set to original value" do
155
155
  @affiliation = pubsub_affiliation_factory :connection => @mock_connection, :affiliation => 'owner'
156
156
  @affiliation.set 'publisher'
@@ -158,87 +158,87 @@ describe Jubjub::Pubsub::Affiliation do
158
158
  end
159
159
  end
160
160
  end
161
-
161
+
162
162
  describe "set_owner" do
163
163
  it "should redirect call to set" do
164
164
  affiliation = pubsub_affiliation_factory
165
165
  affiliation.should_receive(:set).with('owner').and_return( 'from-set' )
166
-
166
+
167
167
  affiliation.set_owner.should == 'from-set'
168
168
  end
169
169
  end
170
-
170
+
171
171
  describe "set_publisher" do
172
172
  it "should redirect call to set" do
173
173
  affiliation = pubsub_affiliation_factory
174
174
  affiliation.should_receive(:set).with('publisher').and_return( 'from-set' )
175
-
175
+
176
176
  affiliation.set_publisher.should == 'from-set'
177
177
  end
178
178
  end
179
-
179
+
180
180
  describe "set_publish_only" do
181
181
  it "should redirect call to set" do
182
182
  affiliation = pubsub_affiliation_factory
183
183
  affiliation.should_receive(:set).with('publish-only').and_return( 'from-set' )
184
-
184
+
185
185
  affiliation.set_publish_only.should == 'from-set'
186
186
  end
187
187
  end
188
-
188
+
189
189
  describe "set_member" do
190
190
  it "should redirect call to set" do
191
191
  affiliation = pubsub_affiliation_factory
192
192
  affiliation.should_receive(:set).with('member').and_return( 'from-set' )
193
-
193
+
194
194
  affiliation.set_member.should == 'from-set'
195
195
  end
196
196
  end
197
-
197
+
198
198
  describe "set_none" do
199
199
  it "should redirect call to set" do
200
200
  affiliation = pubsub_affiliation_factory
201
201
  affiliation.should_receive(:set).with('none').and_return( 'from-set' )
202
-
202
+
203
203
  affiliation.set_none.should == 'from-set'
204
204
  end
205
205
  end
206
-
206
+
207
207
  describe "set_outcast" do
208
208
  it "should redirect call to set" do
209
209
  affiliation = pubsub_affiliation_factory
210
210
  affiliation.should_receive(:set).with('outcast').and_return( 'from-set' )
211
-
211
+
212
212
  affiliation.set_outcast.should == 'from-set'
213
213
  end
214
214
  end
215
-
215
+
216
216
  describe "==" do
217
217
  it "should match equivalent objects" do
218
218
  pubsub_affiliation_factory.should == pubsub_affiliation_factory
219
219
  end
220
-
220
+
221
221
  it "should not distinguish between connections" do
222
222
  pubsub_affiliation_factory(:connection => 'wibble').should == pubsub_affiliation_factory(:connection => 'wobble')
223
223
  end
224
-
224
+
225
225
  it "should still match no matter how jid is initialized" do
226
226
  pubsub_affiliation_factory(:jid => 'foo@bar.com').should == pubsub_affiliation_factory(:jid => Jubjub::Jid.new('foo@bar.com'))
227
227
  end
228
-
228
+
229
229
  it "should still match no matter how pubsub_jid is initialized" do
230
- pubsub_affiliation_factory(:pubsub_jid => 'pubsub.bar.com').should ==
230
+ pubsub_affiliation_factory(:pubsub_jid => 'pubsub.bar.com').should ==
231
231
  pubsub_affiliation_factory(:pubsub_jid => Jubjub::Jid.new('pubsub.bar.com'))
232
232
  end
233
-
233
+
234
234
  it "should not match objects with different attributes" do
235
235
  pubsub_affiliation_factory(:pubsub_jid => 'a.b.com').should_not == pubsub_affiliation_factory
236
- pubsub_affiliation_factory(:pubsub_node => 'waggle').should_not == pubsub_affiliation_factory
236
+ pubsub_affiliation_factory(:pubsub_node => 'waggle').should_not == pubsub_affiliation_factory
237
237
  pubsub_affiliation_factory(:jid => 'a.b.com').should_not == pubsub_affiliation_factory
238
238
  pubsub_affiliation_factory(:affiliation => 'member').should_not == pubsub_affiliation_factory
239
239
  end
240
240
  end
241
-
241
+
242
242
  end
243
-
244
- end
243
+
244
+ end