Sha256: 6e2463a03834b45a37fcb0b77bc6678129a3100b307e43eb862b04b9fce2a4d3

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require 'test_helper'
require 'gem_watch/command_options'

class CommandOptionsTest < Test::Unit::TestCase
  context "initialize empty object" do
    setup do
      @options = GemWatch::CommandOptions.new
    end
    
    should "should initialize object with default values" do
      GemWatch::CommandOptions::Defaults.each do |key, value|
        assert_equal value, @options.send(key)
      end
    end
    
    should "email_recipients= accepts an Array attribute" do
      emails = ['bob@test.com', 'alice@test.com']
      @options.email_recipients = emails
      assert_equal emails, @options.email_recipients
    end
    
    should "email_recipients= accepts a String with only one email address" do
      email = "bob@test.com"
      @options.email_recipients = email
      assert_equal [email], @options.email_recipients
    end
    
    should "email_recipients= accepts a String with coma separated emails" do
      emails = ['bob@test.com', 'alice@test.com']
      @options.email_recipients = emails.join(', ')
      assert_equal emails, @options.email_recipients
    end
    
    should "stdout false if email_recipients is not empty" do
      @options.email_recipients = 'bob@test.com'
      assert_false @options.stdout
    end

    should "stdout false if email_recipients is empty" do
      @options.email_recipients = ''
      assert_true @options.stdout
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gem_watch-0.1.2 test/command_options_test.rb