|
16 | 16 | it "defaults subscription timestamp to current time in milliseconds" do
|
17 | 17 | time = Time.now
|
18 | 18 | Time.stub!(:now).and_return(time)
|
19 |
| - PrivatePub.subscription[:timestamp].should == (time.to_f * 1000).round |
| 19 | + PrivatePub.subscription[:timestamp].should eq((time.to_f * 1000).round) |
20 | 20 | end
|
21 | 21 |
|
22 | 22 | it "loads a simple configuration file via load_config" do
|
23 | 23 | PrivatePub.load_config("spec/fixtures/private_pub.yml", "production")
|
24 |
| - PrivatePub.config[:server].should == "http://example.com/faye" |
25 |
| - PrivatePub.config[:secret_token].should == "PRODUCTION_SECRET_TOKEN" |
26 |
| - PrivatePub.config[:signature_expiration].should == 600 |
| 24 | + PrivatePub.config[:server].should eq("http://example.com/faye") |
| 25 | + PrivatePub.config[:secret_token].should eq("PRODUCTION_SECRET_TOKEN") |
| 26 | + PrivatePub.config[:signature_expiration].should eq(600) |
27 | 27 | end
|
28 | 28 |
|
29 | 29 | it "raises an exception if an invalid environment is passed to load_config" do
|
|
35 | 35 | it "includes channel, server, and custom time in subscription" do
|
36 | 36 | PrivatePub.config[:server] = "server"
|
37 | 37 | subscription = PrivatePub.subscription(:timestamp => 123, :channel => "hello")
|
38 |
| - subscription[:timestamp].should == 123 |
39 |
| - subscription[:channel].should == "hello" |
40 |
| - subscription[:server].should == "server" |
| 38 | + subscription[:timestamp].should eq(123) |
| 39 | + subscription[:channel].should eq("hello") |
| 40 | + subscription[:server].should eq("server") |
41 | 41 | end
|
42 | 42 |
|
43 | 43 | it "does a sha1 digest of channel, timestamp, and secret token" do
|
44 | 44 | PrivatePub.config[:secret_token] = "token"
|
45 | 45 | subscription = PrivatePub.subscription(:timestamp => 123, :channel => "channel")
|
46 |
| - subscription[:signature].should == Digest::SHA1.hexdigest("tokenchannel123") |
| 46 | + subscription[:signature].should eq(Digest::SHA1.hexdigest("tokenchannel123")) |
47 | 47 | end
|
48 | 48 |
|
49 | 49 | it "formats a message hash given a channel and a string for eval" do
|
|
74 | 74 | PrivatePub.config[:server] = "http://localhost"
|
75 | 75 | message = stub(:to_json => "message_json")
|
76 | 76 | Net::HTTP.should_receive(:post_form).with(URI.parse("http://localhost"), :message => "message_json").and_return(:result)
|
77 |
| - PrivatePub.publish_message(message).should == :result |
| 77 | + PrivatePub.publish_message(message).should eq(:result) |
78 | 78 | end
|
79 | 79 |
|
80 | 80 | it "raises an exception if no server is specified when calling publish_message" do
|
|
86 | 86 | it "publish_to passes message to publish_message call" do
|
87 | 87 | PrivatePub.should_receive(:message).with("chan", "foo").and_return("message")
|
88 | 88 | PrivatePub.should_receive(:publish_message).with("message").and_return(:result)
|
89 |
| - PrivatePub.publish_to("chan", "foo").should == :result |
| 89 | + PrivatePub.publish_to("chan", "foo").should eq(:result) |
90 | 90 | end
|
91 | 91 |
|
92 | 92 | it "has a Faye rack app instance" do
|
|
0 commit comments