Sha256: 893ed3753094ef8009868e3c05fdf188d987467aa685cb44513cbd9edee1e2eb

Contents?: true

Size: 982 Bytes

Versions: 2

Compression:

Stored size: 982 Bytes

Contents

require "test_helper"

class MonkeyParty::SubscriberTest < Test::Unit::TestCase
  context "A subscriber" do
    setup do
      @merge_vars = {:merge_var => "MERGE VAR 1"}
      @email = "user@example.com"
      @subscriber = MonkeyParty::Subscriber.new(@email, @merge_vars)
    end

    should "have an email" do
      assert_equal @email, @subscriber.email
    end

    should "have a list of merge fields" do
      assert_equal @merge_vars, @subscriber.merge_fields
    end

    should "have a hashed version of all the attributes" do
      intended_hash = {
        :email => @email
      }.merge(@merge_vars)

      assert_equal intended_hash, @subscriber.to_h
    end

    should "have a mailchimp style hash of all the attributes" do
      intended_hash = {}
      intended_hash["EMAIL"] = @email
      @merge_vars.each do |key, value|
        intended_hash[key.to_s.upcase] = value
      end

      assert_equal intended_hash, @subscriber.to_mailchimp_hash
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dpickett-monkey_party-0.0.1 test/monkey_party/subscriber_test.rb
dpickett-monkey_party-0.0.3 test/monkey_party/subscriber_test.rb