Revision e14b5758
Added by Greg Sutcliffe over 9 years ago
test/functional/locations_controller_test.rb | ||
---|---|---|
end
|
||
test "should assign all hosts with no location to selected location and add taxable_taxonomies" do
|
||
location = taxonomies(:location1)
|
||
assert_difference "location.taxable_taxonomies.count", 8 do
|
||
domain = FactoryGirl.create(:domain, :locations => [taxonomies(:location2)])
|
||
hosts = FactoryGirl.create_list(:host, 2, :domain => domain,
|
||
:environment => environments(:production),
|
||
:location => nil)
|
||
assert_difference "location.taxable_taxonomies.count", 1 do
|
||
post :assign_all_hosts, {:id => location.id}, set_session_user
|
||
end
|
||
end
|
||
... | ... | |
end
|
||
test "assigned selected hosts with no location to selected location" do
|
||
location = taxonomies(:location1)
|
||
selected_hosts_no_location_ids = Host.where(:location_id => nil).limit(2).map(&:id)
|
||
hosts = FactoryGirl.create_list(:host, 2, :location => nil)
|
||
selected_hosts_no_location_ids = hosts.map(&:id)
|
||
|
||
assert_difference "location.hosts.count", 2 do
|
||
put :assign_selected_hosts, {:id => location.id,
|
||
... | ... | |
|
||
# Mismatches
|
||
test "should show all mismatches and button Fix All Mismatches if there are" do
|
||
hosts = FactoryGirl.create_list(:host, 2, :location => taxonomies(:location1))
|
||
TaxableTaxonomy.delete_all
|
||
get :mismatches, {}, set_session_user
|
||
assert_response :success
|
||
... | ... | |
end
|
||
test "should clone location with assocations" do
|
||
location = taxonomies(:location1)
|
||
FactoryGirl.create(:host, :location => nil)
|
||
location_dup = location.clone
|
||
|
||
assert_difference "Location.count", 1 do
|
Also available in: Unified diff
Fixes #7733 - Remove hosts.yml fixtures and use FactoryGirl instead