File: option_test.rb

package info (click to toggle)
ruby-trailblazer-option 0.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 132 kB
  • sloc: ruby: 212; sh: 4; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 590 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require "test_helper"

class DocsOptionTest < Minitest::Spec
  it do
    #:method
    option = Trailblazer::Option(:object_id)
    option.(exec_context: Object.new) # => 1234567
    #:method end

    #:lambda
    option = Trailblazer::Option(-> { object_id })
    option.(exec_context: Object.new) # => 1234567
    #:lambda end

    #:module
    class CallMe
      def self.call(message:, **options)
        message
      end
    end

    option = Trailblazer::Option(CallMe)
    option.(keyword_arguments: { message: "hello!" }, exec_context: nil) # => "hello!"
    #:module end
  end
end