Sha256: ae1649abe442dca0a353922a1f996f6a284664091731b5d3b1a930bf5c39561b

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

require "assert"
require "assert/context/subject_dsl"

module Assert::Context::SubjectDSL
  class UnitTests < Assert::Context
    desc "Assert::Context::SubjectDSL"
    subject { Factory.modes_off_context_class(parent_class1) }

    let(:parent_class1)  { Factory.modes_off_context_class }
    let(:subject_block1) { Proc.new {} }
  end

  class DescriptionTests < UnitTests
    desc "`description` method"

    should "return a string of all the inherited descriptions" do
      parent_class1.desc("parent description")
      subject.desc("and the description for this context")

      exp = "parent description and the description for this context"
      assert_that(subject.description).equals(exp)
    end
  end

  class SubjectFromLocalTests < UnitTests
    desc "`subject` method using local context"

    should "set the subject block on the context class" do
      subject.subject(&subject_block1)

      assert_that(subject.subject).equals(subject_block1)
    end
  end

  class SubjectFromParentTests < UnitTests
    desc "`subject` method using parent context"

    should "default to its parents subject block" do
      parent_class1.subject(&subject_block1)

      assert_that(subject.subject).equals(subject_block1)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
assert-2.19.0 test/unit/context/subject_dsl_tests.rb
assert-2.18.4 test/unit/context/subject_dsl_tests.rb