Sha256: 024e117787543d978cac5a6e66cdb50c316d999f15ea62c9c723d4d95ae27dc2
Contents?: true
Size: 959 Bytes
Versions: 1
Compression:
Stored size: 959 Bytes
Contents
require 'spec_helper' describe Metric::Track do before do reset_config end it "composes the request url" do Metric::Track.compose("hits").should == "http://api.metric.io/track?api_key=spec&metric=hits" end it "gets correct url when tracking" do Metric::Track.should_receive(:compose).with("hits", {}) Metric::Track.track("hits") end it "encodes the request url" do Metric::Track.parse_metric("hits and spaces").should == "&metric=hits+and+spaces" end it "sends trigger param" do url = "http://api.metric.io/track?api_key=spec&metric=hits&trigger=1" Metric::Track.compose("hits", {:trigger => true}).should == url end it "sends custom amount" do url = "http://api.metric.io/track?api_key=spec&metric=hits&amount=42" Metric::Track.compose("hits", {:amount => 42}).should == url end it "does nothing if amount is 0" do Metric::Track.track("hits", {:amount => 0}).should == nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
metric-0.0.6 | spec/metric/track_spec.rb |