Sha256: c0a563b87919a0214276f7dbd491b780b96e5e74cbcd74a547fdd5f067c438a2

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

require 'test_plugin_helper'

module ForemanSalt
  module Api
    module V2
      class SaltEnvironmentsControllerTest < ActionController::TestCase
        test 'should get index' do
          get :index
          assert_response :success
          assert_template 'api/v2/salt_environments/index'
        end

        test 'should show environment' do
          environment = ForemanSalt::SaltEnvironment.create(name: 'foo')
          get :show, params: { id: environment.id }
          assert_response :success
          assert_template 'api/v2/salt_environments/show'
        end

        test 'should create environment' do
          post :create, params: { environment: { name: 'unicorn' } }
          assert_response :success
          assert ForemanSalt::SaltEnvironment.find_by(name: 'unicorn')
          assert_template 'api/v2/salt_environments/create'
        end

        test 'should delete environment' do
          environment = ForemanSalt::SaltEnvironment.create(name: 'foo.bar.baz')
          assert_difference('ForemanSalt::SaltEnvironment.count', -1) do
            delete :destroy, params: { id: environment.id }
          end
          assert_response :success
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foreman_salt-16.0.0 test/functional/api/v2/salt_environments_controller_test.rb
foreman_salt-15.2.3 test/functional/api/v2/salt_environments_controller_test.rb
foreman_salt-15.2.2 test/functional/api/v2/salt_environments_controller_test.rb
foreman_salt-15.2.1 test/functional/api/v2/salt_environments_controller_test.rb
foreman_salt-15.2.0 test/functional/api/v2/salt_environments_controller_test.rb
foreman_salt-15.1.0 test/functional/api/v2/salt_environments_controller_test.rb
foreman_salt-15.0.0 test/functional/api/v2/salt_environments_controller_test.rb
foreman_salt-14.1.0 test/functional/api/v2/salt_environments_controller_test.rb