Skip to content

Instantly share code, notes, and snippets.

@daviddavis
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daviddavis/4e4a0cb389b4685ae19a to your computer and use it in GitHub Desktop.
Save daviddavis/4e4a0cb389b4685ae19a to your computer and use it in GitHub Desktop.
#
# Copyright 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
require 'katello_test_helper'
class Actions::Headpin::Environment::LibraryCreateTest < ActiveSupport::TestCase
include Dynflow::Testing
include Support::Actions::Fixtures
include Support::Actions::RemoteAction
include FactoryGirl::Syntax::Methods
describe "Library Create" do
let(:action_class) { ::Actions::Headpin::Environment::LibraryCreate }
let(:action) { create_action action_class }
let(:library) do
katello_environments(:library)
end
let(:content_view) do
katello_content_views(:library_view)
end
let(:content_view_environment) do
katello_content_view_environments(:library_default_view_environment)
end
it 'plans' do
library.expects(:save!)
::Katello::ContentView.expects(:create!).returns(content_view).with do |arg_hash|
arg_hash[:default] == true
end
content_view.expects(:add_environment).once.with(library).returns(content_view_environment)
::Katello::ContentViewVersion.expects(:create!)
plan_action(action, library)
assert_action_planed_with(action,
::Actions::Headpin::ContentView::Create,
content_view)
assert_action_planed_with(action,
::Actions::Headpin::ContentView::EnvironmentCreate,
content_view_environment)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment