spec/metric/receive_spec.rb in metric-0.0.7 vs spec/metric/receive_spec.rb in metric-0.0.8

- old
+ new

@@ -3,32 +3,34 @@ describe Metric::Receive do it "generates correct hash via secret_token" do Metric::Receive.generate_token("hits").should == "c6daa87bcf8bf7cb4d1c74d872793e5e" end - it "gets total" do - request = "http://api.metric.io/receive?api_key=spec&token=c6daa87bcf8bf7cb4d1c74d872793e5e&metric=hits&range=total" - Metric::Receive.compose("hits", "total").should == request - end + context "generating correct url" do + it "total" do + request = "https://api.metric.io/receive?api_key=spec&token=c6daa87bcf8bf7cb4d1c74d872793e5e&metric=hits&range=total" + Metric::Receive.compose("hits", "total").should == request + end - it "gets today" do - request = "http://api.metric.io/receive?api_key=spec&token=c6daa87bcf8bf7cb4d1c74d872793e5e&metric=hits&range=today" - Metric::Receive.compose("hits", "today").should == request - end + it "today" do + request = "https://api.metric.io/receive?api_key=spec&token=c6daa87bcf8bf7cb4d1c74d872793e5e&metric=hits&range=today" + Metric::Receive.compose("hits", "today").should == request + end - it "gets week" do - request = "http://api.metric.io/receive?api_key=spec&token=c6daa87bcf8bf7cb4d1c74d872793e5e&metric=hits&range=week" - Metric::Receive.compose("hits", "week").should == request - end + it "week" do + request = "https://api.metric.io/receive?api_key=spec&token=c6daa87bcf8bf7cb4d1c74d872793e5e&metric=hits&range=week" + Metric::Receive.compose("hits", "week").should == request + end - it "gets month" do - request = "http://api.metric.io/receive?api_key=spec&token=c6daa87bcf8bf7cb4d1c74d872793e5e&metric=hits&range=month" - Metric::Receive.compose("hits", "month").should == request + it "month" do + request = "https://api.metric.io/receive?api_key=spec&token=c6daa87bcf8bf7cb4d1c74d872793e5e&metric=hits&range=month" + Metric::Receive.compose("hits", "month").should == request + end end it "grabs actual data" do - stub_request(:get, "http://api.metric.io/receive?api_key=spec&metric=hits&range=today&token=c6daa87bcf8bf7cb4d1c74d872793e5e"). + stub_request(:get, "https://api.metric.io/receive?api_key=spec&metric=hits&range=total&token=c6daa87bcf8bf7cb4d1c74d872793e5e"). to_return(:status => 200, :body => "{\"total\":\"1\"}", :headers => {}) - Metric::Receive.receive("hits", "today").should == {"total" => "1"} + Metric::Receive.receive("hits", "total").should == {"total" => "1"} end end