Sha256: 358a25af338a07aaca338b6736dce2eeb5ea148efd4d26949e6d00c393637a7f
Contents?: true
Size: 820 Bytes
Versions: 3
Compression:
Stored size: 820 Bytes
Contents
require "spec_helper" class Viewable < ActiveRecord::Base include Monocle::Views end describe Viewable do subject { Viewable.new } it { should have_one(:overall_view) } it { should have_many(:daily_views) } it { should have_many(:weekly_views) } it { should have_many(:monthly_views) } it { should have_many(:yearly_views) } describe "view!" do before do subject.save! end it "should increment overall view count" do subject.view! subject.overall_views.should == 1 end %w( daily weekly monthly yearly ).each do |time_span| it "should increment #{time_span} view count" do 5.times do |i| view = "#{time_span}_views" subject.view! subject.send(view).first.views.should == i + 1 end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
monocle-0.1.1 | spec/viewable_spec.rb |
monocle-0.1.0 | spec/viewable_spec.rb |
monocle-0.0.1 | spec/viewable_spec.rb |