Sha256: 25d16f24fc4ded1c38daa22884dcddab528cca33f3c208f62bafebf9dfc3abcd

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

require 'test_helper'

class Api::V1::EnvironmentsControllerTest < ActionController::TestCase

  development_environment = { :name => 'Development' }

  test "should get index" do
    get :index, { }
    assert_response :success
    assert_not_nil assigns(:environments)
    envs = ActiveSupport::JSON.decode(@response.body)
    assert !envs.empty?
  end

  test "should show environment" do
    get :show, { :id => environments(:production).to_param }
    assert_response :success
    show_response = ActiveSupport::JSON.decode(@response.body)
    assert !show_response.empty?
  end

  test "should create environment" do
    assert_difference('Environment.count') do
      post :create, { :environment => development_environment }
    end
    assert_response :success
  end

  test "should update environment" do
    put :update, { :id => environments(:production).to_param, :environment => { } }
    assert_response :success
  end

  test "should destroy environments" do
    assert_difference('Environment.count', -1) do
      delete :destroy, { :id => environments(:testing).to_param }
    end
    assert_response :success
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_discovery-1.0.0 test/foreman_app/test/functional/api/v1/environments_controller_test.rb
foreman_discovery-1.0.0.rc4 test/foreman_app/test/functional/api/v1/environments_controller_test.rb
foreman_discovery-1.0.0.rc3 test/foreman_app/test/functional/api/v1/environments_controller_test.rb
foreman_discovery-1.0.0.rc2 test/foreman_app/test/functional/api/v1/environments_controller_test.rb
foreman_discovery-1.0.0.rc1 test/foreman_app/test/functional/api/v1/environments_controller_test.rb