Sha256: d6381b571493a790074a2328860ac1e209b2d4fb289e6273f96c39120fa4bc06
Contents?: true
Size: 768 Bytes
Versions: 1
Compression:
Stored size: 768 Bytes
Contents
require 'spec_helper' describe 'Saving metrics' do let(:user) { User.create! } it "saves a new value" do NanoMetrics.increment :view, user NanoMetrics::Context.for_action_and_metricable(:view, user).metrics.count. should == 1 end it "saves new contexts if they don't exist" do NanoMetrics.increment :view, user NanoMetrics::Context.where( action: 'view', metricable_id: user.id, metricable_type: 'User' ).count.should == 1 end it "re-uses existing contexts when appropriate" do NanoMetrics::Context.create action: :view, metricable: user NanoMetrics.increment :view, user NanoMetrics::Context.where( action: 'view', metricable_id: user.id, metricable_type: 'User' ).count.should == 1 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nano_metrics-0.0.1 | spec/acceptance/saving_metrics_spec.rb |