test/unit/context/subject_dsl_tests.rb in assert-2.18.2 vs test/unit/context/subject_dsl_tests.rb in assert-2.18.3

- old
+ new

@@ -1,72 +1,45 @@ require "assert" require "assert/context/subject_dsl" module Assert::Context::SubjectDSL - class UnitTests < Assert::Context desc "Assert::Context::SubjectDSL" - subject{ @context_class } - end + subject { context_class1 } - class DescriptionsTests < UnitTests - desc "`descriptions` method" - setup do - descs = @descs = ["something amazing", "it really is"] - @context_class = Factory.modes_off_context_class do - descs.each{ |text| desc text } - end - end - - should "return a collection containing any descriptions defined on the class" do - assert_equal @descs, subject.send(:descriptions) - end + let(:parent_class1) { Factory.modes_off_context_class } + let(:context_class1) { Factory.modes_off_context_class(parent_class1) } + let(:subject_block1) { Proc.new {} } end class DescriptionTests < UnitTests desc "`description` method" - setup do - parent_text = @parent_desc = "parent description" - @parent_class = Factory.modes_off_context_class do - desc parent_text - end - text = @desc = "and the description for this context" - @context_class = Factory.modes_off_context_class(@parent_class) do - desc text - end - end should "return a string of all the inherited descriptions" do - exp_desc = "parent description and the description for this context" - assert_equal exp_desc, @context_class.description + 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" - setup do - subject_block = @subject_block = ::Proc.new{ @something } - @context_class = Factory.modes_off_context_class do - subject(&subject_block) - end - end should "set the subject block on the context class" do - assert_equal @subject_block, @context_class.subject + subject.subject(&subject_block1) + + assert_that(subject.subject).equals(subject_block1) end end class SubjectFromParentTests < UnitTests desc "`subject` method using parent context" - setup do - parent_block = @parent_block = ::Proc.new{ @something } - @parent_class = Factory.modes_off_context_class do - subject(&parent_block) - end - @context_class = Factory.modes_off_context_class(@parent_class) - end - should "default to it's parents subject block" do - assert_equal @parent_block, @context_class.subject + should "default to its parents subject block" do + parent_class1.subject(&subject_block1) + + assert_that(subject.subject).equals(subject_block1) end end end