Sha256: d269dc81e4823b87d0275e1b90559f5c225e5cd3484b9ff08afdd0dc5a3137d1

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require 'rake'

describe 'meter_cat rake tasks' do

  before(:each) do
    @rake = Rake::Application.new
    Rake.application = @rake
    Rake::Task.define_task(:environment)
    load 'lib/tasks/meter_cat.rake'
  end

  #############################################################################
  # meter_cat:mail

  describe 'meter_cat:mail' do

    it 'calls sends the report email' do
      MeterCat.should_receive(:mail)
      @rake['meter_cat:mail'].invoke
    end
  end

  #############################################################################
  # meter_cat:random[name,min,max,start,stop]

  describe 'meter_cat:random[name,min,max,days]' do

    before(:each) do
      @name = 'test'
      @min = '1'
      @max = '10'
      @days = '365'
    end

    it 'calls Meter::random with the args' do
      MeterCat::Meter.should_receive(:random) do |args|
        args[:name].should eql(@name)
        args[:min].should eql(@min)
        args[:max].should eql(@max)
        args[:days].should eql(@days)
      end
      @rake['meter_cat:random'].invoke(@name, @min, @max, @days)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
meter_cat-5.0.1 spec/lib/tasks/meter_cat.rake_spec.rb
meter_cat-5.0.0 spec/lib/tasks/meter_cat.rake_spec.rb