Sha256: 4b6f14d43b0c271a3c3765a4b775a6ea0167896edde001aa0a6beb43c438daac

Contents?: true

Size: 1.15 KB

Versions: 80

Compression:

Stored size: 1.15 KB

Contents

require_relative '../test_helper'

module Generator
  class ExerciseCaseTest < Minitest::Test
    def test_name
      subject = ExerciseCase.new(canonical: OpenStruct.new(description: 'foo'))
      assert_equal 'test_foo', subject.name
    end

    def test_skipped_index_zero
      assert_equal '# skip', ExerciseCase.new(canonical: nil).skipped(0)
    end

    def test_skipped_index_nonzero
      assert_equal 'skip', ExerciseCase.new(canonical: nil).skipped(1)
    end

    def test_forwarding_to_canonical
      mock_canonical = Minitest::Mock.new
      mock_canonical.expect :key, 'fake value'
      subject = ExerciseCase.new(canonical: mock_canonical)
      subject.key
      mock_canonical.verify
    end

    def test_method_mising_calls_super
      subject = ExerciseCase.new(canonical: nil)
      assert_raises NoMethodError do
        subject.key
      end
    end

    def test_true_respond_to?
      subject = ExerciseCase.new(canonical: OpenStruct.new(key: 'value'))
      assert subject.respond_to?(:key)
    end

    def test_false_respond_to?
      subject = ExerciseCase.new(canonical: OpenStruct.new())
      refute subject.respond_to?(:key)
    end
  end
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
trackler-2.2.1.42 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.41 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.40 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.39 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.38 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.37 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.36 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.35 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.34 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.33 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.32 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.31 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.30 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.29 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.28 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.27 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.26 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.25 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.24 tracks/ruby/test/generator/exercise_case_test.rb
trackler-2.2.1.23 tracks/ruby/test/generator/exercise_case_test.rb