Sha256: b46bc94aa85cd3fa3406284d6d9d1b5832f0d02ed01734774a02e8f025b775ea

Contents?: true

Size: 974 Bytes

Versions: 3

Compression:

Stored size: 974 Bytes

Contents

# frozen_string_literal: true

require "test_helper"

class DslTest < Minitest::Test
  let(:dsl) { Aitch::DSL.new }

  test "sets url" do
    dsl.url "URL"
    assert_equal "URL", dsl.url
  end

  test "sets options" do
    dsl.options "OPTIONS"
    assert_equal "OPTIONS", dsl.options
  end

  test "sets headers" do
    dsl.headers "HEADERS"
    assert_equal "HEADERS", dsl.headers
  end

  test "sets data" do
    dsl.data "DATA"
    assert_equal "DATA", dsl.data
  end

  test "sets data through params" do
    dsl.params "PARAMS"
    assert_equal "PARAMS", dsl.data
  end

  test "sets data through body" do
    dsl.body "BODY"
    assert_equal "BODY", dsl.data
  end

  test "returns hash" do
    dsl.options "OPTIONS"
    dsl.headers "HEADERS"
    dsl.url "URL"
    dsl.data "DATA"

    assert_equal "DATA", dsl.to_h[:data]
    assert_equal "HEADERS", dsl.to_h[:headers]
    assert_equal "URL", dsl.to_h[:url]
    assert_equal "OPTIONS", dsl.to_h[:options]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
aitch-1.2.1 test/aitch/dsl_test.rb
aitch-1.2.0 test/aitch/dsl_test.rb
aitch-1.1.0 test/aitch/dsl_test.rb