Sha256: a63af6e6b06b63c687701613783952c79e7207cb95f52e79152b143cb49cb361

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

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

6 entries across 6 versions & 1 rubygems

Version Path
assert-2.19.8 test/unit/context/subject_dsl_tests.rb
assert-2.19.7 test/unit/context/subject_dsl_tests.rb
assert-2.19.6 test/unit/context/subject_dsl_tests.rb
assert-2.19.5 test/unit/context/subject_dsl_tests.rb
assert-2.19.4 test/unit/context/subject_dsl_tests.rb
assert-2.19.3 test/unit/context/subject_dsl_tests.rb