Skip to content

Instantly share code, notes, and snippets.

@domcleal
Created August 23, 2013 15:13
Show Gist options
  • Select an option

  • Save domcleal/6320460 to your computer and use it in GitHub Desktop.

Select an option

Save domcleal/6320460 to your computer and use it in GitHub Desktop.
diff --git a/test/functional/compute_resources_controller_test.rb b/test/functional/compute_resources_controller_test.rb
index b7c3c89..566953a 100644
--- a/test/functional/compute_resources_controller_test.rb
+++ b/test/functional/compute_resources_controller_test.rb
@@ -4,6 +4,11 @@ class ComputeResourcesControllerTest < ActionController::TestCase
setup do
@compute_resource = compute_resources(:mycompute)
@your_compute_resource = compute_resources(:yourcompute)
+ Fog.mock!
+ end
+
+ teardown do
+ Fog.unmock!
end
test "should not get index when not permitted" do
@@ -135,6 +140,15 @@ class ComputeResourcesControllerTest < ActionController::TestCase
assert_redirected_to compute_resources_path
end
+ test "should associate host" do
+ as_admin do
+ put :associate, {:id => @compute_resource.to_param}, set_session_user
+ end
+ assert_redirected_to compute_resources_path
+ assert_equal "dom.uuid", hosts(:two).uuid
+ assert_equal @compute_resource, hosts(:two).compute_resource
+ end
+
def set_session_user
User.current = users(:admin) unless User.current
SETTINGS[:login] ? {:user => User.current.id, :expires_at => 5.minutes.from_now} : {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment