Class: ActiveSupport::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/hephaestus/support/rails.rb

Instance Method Summary collapse

Instance Method Details

#assert_expected_args(expected_args) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hephaestus/support/rails.rb', line 22

def assert_expected_args(expected_args)
  lambda do |job_args_arr|
    job_args_arr.first.each do |actual_args|
      actual_key = actual_args.first
      actual_value = actual_args.second

      expected_value = expected_args[actual_key]

      assert_equal(expected_value, actual_value, "Expected `#{actual_key}` to be `#{expected_value.nil? ? "nil" : expected_value}`, but was `#{actual_value.nil? ? "nil" : actual_value}`")
    end
  end
end

#file_fixture_path(dir, name) ⇒ Object



18
19
20
# File 'lib/hephaestus/support/rails.rb', line 18

def file_fixture_path(dir, name)
  Rails.root.join("test", "fixtures", "files", dir, name)
end

#setupObject



9
10
11
12
13
14
15
16
# File 'lib/hephaestus/support/rails.rb', line 9

def setup
  @organization_id ||= "org_#{Faker::Alphanumeric.alphanumeric(number: 26).upcase}"
  @plug_installation_id ||= "pli_#{Faker::Alphanumeric.alphanumeric(number: 26).upcase}"
  @inbox_id ||= "ibx_#{Faker::Alphanumeric.alphanumeric(number: 26).upcase}"
  @plug_id ||= "plg_#{Faker::Alphanumeric.alphanumeric(number: 26).upcase}"
  @message_id ||= "msg_#{Faker::Alphanumeric.alphanumeric(number: 26).upcase}"
  @conversation_id ||= "cnv_#{Faker::Alphanumeric.alphanumeric(number: 26).upcase}"
end