Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# test/controllers/api/v2/domains_controller_test.rb
test "should get domains for searched location only" do
hg = FactoryGirl.create(:hostgroup, :id => domains(:yourdomain).id, :location_ids => [taxonomies(:location2).id])
taxonomies(:location2).domain_ids = [domains(:unuseddomain).id]
get :index, {:search => "location_id=#{taxonomies(:location2).id}" }
assert_response :success
assert_equal taxonomies(:location2).domains.length, assigns(:domains).length
assert_equal assigns(:domains), taxonomies(:location2).domains
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment