summaryrefslogtreecommitdiff
path: root/spec/models/serverless/function_spec.rb
blob: 810d4409a341607c84ebfe51d005b7c1783c880c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'spec_helper'

describe ::Serverless::Function do
  let(:project) { create(:project) }
  let(:func) { described_class.new(project, 'test', 'test-ns') }

  it 'has a proper id' do
    expect(func.id).to eql("#{project.id}/test/test-ns")
    expect(func.name).to eql("test")
    expect(func.namespace).to eql("test-ns")
  end

  it 'can decode an identifier' do
    f = described_class.find_by_id("#{project.id}/testfunc/dummy-ns")

    expect(f.name).to eql("testfunc")
    expect(f.namespace).to eql("dummy-ns")
  end
end