Sha256: d456ff9a526908a631eeaf805edf0a3071988e7fcd3cdbf7d5eada871bcf076f

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'assert'
require 'cap-util/server_roles_yaml'

class CapUtil::ServerRolesYaml

  class UnitTests < Assert::Context
    desc "CapUtil::ServerRolesYaml"
    setup do
      @roles_yaml = CapUtil::ServerRolesYaml.new(CapUtil::FakeCap.new)
    end
    subject{ @roles_yaml }

    should have_imeths :get, :validate, :valid?, :read
    should have_reader :desc, :source

    should "default the yaml's desc and source" do
      assert_equal "server roles", subject.desc
      assert_equal "", subject.source
    end

    should "use a custom desc and source if given" do
      yml = CapUtil::ServerRolesYaml.new(CapUtil::FakeCap.new, {
        :desc => 'staging',
        :source => 'the place'
      })
      assert_equal "staging server roles", yml.desc
      assert_equal " from the place", yml.source
    end

    should "raise appropriate NotImplementedErrors" do
      assert_raises(NotImplementedError) { subject.validate }
      assert_raises(NotImplementedError) { subject.valid? }
      assert_raises(NotImplementedError) { subject.read }
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cap-util-1.5.2 test/unit/server_roles_yaml_tests.rb
cap-util-1.5.1 test/unit/server_roles_yaml_tests.rb
cap-util-1.5.0 test/unit/server_roles_yaml_tests.rb