Sha256: 5e968eb6fcad4d3ef003022fd36bfa8723e025a274e437dc3827e5df5cdd1e9a
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
require 'spec_helper' describe Metric::Receive do it "generates correct hash via secret_token" do Metric::Receive.generate_token("hits", "week").should == "47639a31c68c36a3406870dfff900679" end context "generating correct url" do it "total" do result = "https://api.metric.io/v1/sites/spec/statistics?metric=hits&range=total&token=e66652e1c3e7fdda10d6fb97cb279622" Metric::Receive.compose("hits", "total").should == result end it "today" do result = "https://api.metric.io/v1/sites/spec/statistics?metric=hits&range=today&token=1650709162cd5e699e079e14f8e1decc" Metric::Receive.compose("hits", "today").should == result end it "week" do result = "https://api.metric.io/v1/sites/spec/statistics?metric=hits&range=week&token=47639a31c68c36a3406870dfff900679" Metric::Receive.compose("hits", "week").should == result end it "month" do result = "https://api.metric.io/v1/sites/spec/statistics?metric=hits&range=month&token=f66049db427350067ed60fb6c986d687" Metric::Receive.compose("hits", "month").should == result end end it "grabs actual data" do stub_request(:get, "https://api.metric.io/v1/sites/spec/statistics?metric=hits&range=total&token=e66652e1c3e7fdda10d6fb97cb279622"). to_return(:status => 200, :body => "{\"total\":1}", :headers => {}) Metric::Receive.receive("hits", "total").should == 1 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
metric-0.1.2 | spec/metric/receive_spec.rb |
metric-0.1.1 | spec/metric/receive_spec.rb |
metric-0.1.0 | spec/metric/receive_spec.rb |