spec/danthes_spec.rb in danthes-1.0.4 vs spec/danthes_spec.rb in danthes-1.0.5

- old
+ new

@@ -15,11 +15,11 @@ config[:signature_expiration].should be_nil end it "defaults subscription timestamp to current time in milliseconds" do time = Time.now - Time.stub!(:now).and_return(time) + Time.stub(:now).and_return(time) Danthes.subscription[:timestamp].should eq((time.to_f * 1000).round) end it "loads a simple configuration file via load_config" do Danthes.env = 'production' @@ -28,10 +28,17 @@ config[:secret_token].should eq("PRODUCTION_SECRET_TOKEN") config[:signature_expiration].should eq(600) config[:adapter].should eq('thin') end + it "loads configuration file with erb via load_config" do + ENV['DANTHES_SERVER'] = "http://example.com" + Danthes.env = 'production' + Danthes.load_config("spec/fixtures/danthes_with_erb.yml") + config[:server].should eq("http://example.com") + end + context "when redis config exists" do before do Danthes.env = 'test' Danthes.load_redis_config("spec/fixtures/danthes_redis.yml") end @@ -128,20 +135,20 @@ end it "it should use HTTPS if the server URL says so" do Danthes.config[:server] = "https://localhost" Danthes.config[:mount] = '/faye/path' - http = mock(:http).as_null_object + http = double(:http).as_null_object Net::HTTP.should_receive(:new).and_return(http) http.should_receive(:use_ssl=).with(true) Danthes.publish_message('foo') end it "it should not use HTTPS if the server URL says not to" do Danthes.config[:server] = "http://localhost" - http = mock(:http).as_null_object + http = double(:http).as_null_object Net::HTTP.should_receive(:new).and_return(http) http.should_receive(:use_ssl=).with(false) Danthes.publish_message('foo')