Sha256: 0fdae377332ec73b80f05ea275f3c2cbe8698698e83d9243061417f41a1ff0f0

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

# Stats::Message Methods
describe MailUp::Stats::Message do
  before(:each){ init_mailup }

  %w(recipients recipients_count views views_count bounces bounces_count unsubscribes unsubscribes_count clicks clicks_count url_clicks url_clicks_count).each do |method|
    it "should have a #{method} method" do
      @mailup.stats.message(1).should respond_to(method.to_sym)
    end
  end

  # List methods

  %w(recipients views bounces clicks url_clicks).each do |method|
    it "should fire the correct GET request for #{method}" do
      @mailup.stats.message(1).api.should_receive(:get).with("#{@mailup.stats.message(1).api.path}/Message/1/List/#{method.split('_').collect(&:capitalize).join}", {params: {}})
      @mailup.stats.message(1).send(method.to_sym)
    end
  end

  # Count methods

  %w(recipients_count views_count bounces_count clicks_count).each do |method|
    it "should fire the correct GET request for #{method}" do
      @mailup.stats.message(1).api.should_receive(:get).with("#{@mailup.stats.message(1).api.path}/Message/1/Count/#{method.split('_').first.capitalize}")
      @mailup.stats.message(1).send(method.to_sym)
    end
  end

  it "should fire the correct GET request for url_clicks_count" do
    @mailup.stats.message(1).api.should_receive(:get).with("#{@mailup.stats.message(1).api.path}/Message/1/Count/UrlClicks")
    @mailup.stats.message(1).url_clicks_count
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mailup-1.2.0 spec/mailup/stats/message_spec.rb
mailup-1.1.0 spec/mailup/stats/message_spec.rb